Reputation: 5089
I'm following the documentation here but I end up with a jar
that doesn't find the war
to execute. Here's the error:
java.io.FileNotFoundException: C:\Users\ortizj\Documents\NetBeansProjects\valida
tion-manager\Validation-Manager-Web\target\.extract\webapps\ROOT.war (The system
cannot find the file specified)
For some reason the war
file is not added to the jar
so it fails when it's extracting it.
ROOT.war
exists and is present in the target folder.
Here's the relevant POM contents:
<profile>
<id>installer</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>tomcat-run</id>
<goals>
<goal>exec-war-only</goal>
</goals>
<phase>package</phase>
<configuration>
<warRunDependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>Validation-Manager-Web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<charset>utf-8</charset>
<httpPort>9078</httpPort>
<contextPath>/</contextPath>
</warRunDependency>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Upvotes: 1
Views: 2110
Reputation: 3313
As a alternative for tomcat, You can use jetty as server. Therefore POM should be added flowing plugins.
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>myapp</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.5.v20170502</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webApp>
<contextPath>/myapp</contextPath>
</webApp>
</configuration>
</plugin>
</plugins>
</pluginManagement>
You can run it as following.
mvn clean install
mvn jetty:run
You app will be start on default port 8080 under given context (In this "myapp").
Upvotes: -1
Reputation: 116
How about adding this to your pom.xml file..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>your-war-name</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
<outputDirectory>${deploy-path}</outputDirectory>
</configuration>
</plugin>
Upvotes: 3
Reputation: 2181
You are missing the decency on your war. Therefore it is not included:
<warRunDependencies>
<warRunDependency>
<dependency>
<groupId>a groupId</groupId>
<artifactId>and artifactId</artifactId>
<version>version</version>
<type>war</type>
</dependency>
<contextPath>/</contextPath>
</warRunDependency>
</warRunDependencies>
Upvotes: 1