I have Spring MVC application and below is the structure attached
The problem I am facing is whenever my maven builds the war file then it does not deploy properly on the tomcat.But when I export manually then it runs absolutely fine.
I compared both the war files after extraction, there's a difference that all of the XML files are not included in the WEB-INF folder, although there is a classes folder present. Can anyone help? This is a snippet of my pom.xml file
<sourceDirectory>src/</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<resource>
<directory>/src/main/webapp</directory>
</resource>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>hfcl</warName>
<!-- <failOnMissingWebXml>false</failOnMissingWebXml> <webXml>WebContent\WEB-INF\web.xml</webXml> -->
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webXml>WebContent\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
Maybe maven filters out the xml files. Adding the resources tag under the build tag like this:
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/xml</directory>
</resource>
</resources>
<plugin>
....
</build>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.