I want my build process to deploy my war to a remote server. until now i have ran mvn clean install tomcat7:deploy
This seem wrong to me as it should probably be part of the deploy
phase. But if I try to do a mvn deploy
i get:
Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
Since I haven't defined any repository to deploy to (I don't really want to deploy to a remote repository, just using this phase to execute the tomcat maven plugin...)
I want to be able to run the tomcat maven plugin without deploying to any remote repository. Is that possible ?
There is the Tomcat Maven Plugin 7 plugin developed by the Apache Tomcat team. Currently you have to checkout the sources and install it to your local repository. After that you can use it in the plugin section of your pom:
The second way to add goals to phases is to configure plugins in your project. Plugins are artifacts that provide goals to Maven. Furthermore, a plugin may have one or more goals wherein each goal represents a capability of that plugin. For example, the Compiler plugin has two goals: compile and testCompile.
Same as exec-war goal without forking the package lifecycle. Display help information on tomcat7-maven-plugin. Call mvn tomcat7:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
Run application with tomcat plugin. To run the application with tomcat maven plugin, use maven goal as –. mvn tomcat7:run. When you run above maven goal, you can see tomcat starting in console log with default port 8080.
The plugin doesn't execute by default. You have to add an execution to it, or call it like you did(f.e. mvn clean install tomcat7:deploy).
The deploy on Tomcat has nothing to do with the Maven deploy phase/deploying to a remote repository.
To bind the Tomcat deployment to a certain phase, add something like this to your tomcat maven plugin configuration:
<executions>
<execution>
<id>tomcat-deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
In this configuration, the deployment to Tomcat will occur in the pre-integration-test phase, which is the most common phase to do this in I believe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With