We Are Going To Discuss About Generate War file using Maven . So lets Start this Java Article.
Generate War file using Maven
- Generate War file using Maven
Project > run as > run config > maven build in left panel > right click > new > goal >
clean install
> base directory> select your current project workspace.> apply> run - Generate War file using Maven
Project > run as > run config > maven build in left panel > right click > new > goal >
clean install
> base directory> select your current project workspace.> apply> run
Solution 1
First you must define your project with as packaging of war type:
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<packaging>war</packaging>
Then you will need to use the maven plugin to generate the war when compiling:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<attachClasses>true</attachClasses>
<webXml>target/web.xml</webXml>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
Original Author Sergio Gragera Of This Content
Solution 2
Try running clean install
or clean package
maven command.
Project > run as > run config > maven build in left panel > right click > new > goal > clean install
> base directory> select your current project workspace.> apply> run
same way for clean package
or any other maven command.
if it gives BUILD SUCCESS
then fine otherwise put that error code here in the question.
Original Author R Dhaval Of This Content
Solution 3
one solution is just to use a maven-war-plugin(https://maven.apache.org/plugins/maven-war-plugin/index.html)
Original Author Mobility Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.