Reputation: 1433
This is a test project structure.
There are resources, java, webapp
folders inside of src/main
. Default maven project, right?
And I need to export this project as war
so tried mvn war:war
on cmd.
But the unexpected result. the images
folder, which is in the webapp
folder, should be placed in the root of war, but it is in the WEB-INF/classes
.
I don't get what is wrong. I didn't touch the pom.xml
:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maventest</groupId>
<artifactId>maventest</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>maventest Maven Webapp</name>
<url>http://maven.apache.org</url>
<build>
<finalName>maventest</finalName>
</build>
</project>
Upvotes: 0
Views: 827
Reputation: 1361
Try creating WebContent
folder containing images
and WEB-INF
folders at the same level of src
folder and bundle them into a war file.
Also as you mentioned, add below into maven-war-plugin
<warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
Upvotes: 1