Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default phase for tomcat7 maven plugin?

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 ?

like image 411
Michael Avatar asked Sep 23 '12 19:09

Michael


People also ask

Is there a Maven plugin for Tomcat?

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:

How do I add goals to phases in Maven?

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.

How to display help information on tomcat7-maven-plugin using exec-war goal?

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.

How do I run a Tomcat application in Linux?

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.


1 Answers

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.

like image 54
Integrating Stuff Avatar answered Sep 21 '22 06:09

Integrating Stuff