Specifying a directory for a package using the tomcat7-maven-plugin module

I use tomcat7-maven-pluginand my web application is stored in src/main/webapp. This is a React application, so I run npm run buildto generate a "compiled" version in src/main/webapp/build. My problem is that whenever I pack webapp, the whole folder is webapppacked (including node_modules...) instead of the folder build.

Here is my plugin configuration:

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <configuration>
                <port>9090</port>
                <!-- I am looking for something of the following form -->
                <webappPath>build</webappPath>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>

How can I make a plugin a package only webapp/build? Or maybe there is a way to at least exclude from the package node_modules, since all these modules are used only to create this packaged version of my webapp?

+4
source share
2 answers

tomcat7-maven . undeploy tomcat.

maven WAR, WAR https://maven.apache.org/plugins/maven-war-plugin/usage.html

, ,

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <warSourceDirectory>your source directory</warSourceDirectory>
    </configuration>
</plugin>
+1

    <project>
  ...
  <name>My Resources Plugin Practice Project</name>
  ...
  <build>
    ...
    <resources>
      <resource>
        <directory>src/my-resources</directory>
        <includes>
          <include>**/*.txt</include>
        </includes>
        <excludes>
          <exclude>**/*test*.*</exclude>
        </excludes>
      </resource>
      ...
    </resources>
    ...
  </build>
  ...
</project>

Apache Maven

+1

Source: https://habr.com/ru/post/1694211/


All Articles