Generate War file using Maven
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>
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.
one solution is just to use a maven-war-plugin(https://maven.apache.org/plugins/maven-war-plugin/index.html)