Create a .war file using maven. Missing Files and Directories

I am trying to create a .war file using the maven plugin:

  <plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
      <warSourceDirectory>WebContent</warSourceDirectory>
      <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
  </plugin>

My project structure is as follows:

/main/webapp/WEB-INF/
/main/webapp/WEB-INF/spring/...
/main/webapp/WEB-INF/web.xml
/main/webapp/public/...
/main/webapp/resources/...
/main/webapp/views/...

After assembly, my war file contains only WEB-INF and META-INF. Missing all other webapp directory content (public, resources, and views). In addition, the WEB-INF directory in the .war file consists only of the / classes and / lib directories (/ WEB-INF / spring and WEB-INF / web.xml are missig).

How to tell maven to pack the contents of webapp and WEB-INF into a war file?

+4
source share
3 answers

maven-war-plugin . <warSourceDirectory>WebContent</warSourceDirectory> maven-war-plugin - WebContent. main/webapp.

webapp src/main/webapp ( main/webapp) maven-war-plugin :

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
         <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
</plugin>

maven-war-plugin webapp src/main/webapp.

+2

Maven, .

mvn clean package
0

. Maven: webapp scr/main/webapp main/webapp. maven . . https://maven.apache.org/pom.html#Build_Settings

0

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


All Articles