Replace default Maven lifecycle goals

When I run mvn deploy in my project with <packaging>war</packaging> , I get an error:

[ERROR] Failed to fulfill target org.apache.maven.plugins: maven-deploy-plugin: 2.5: deploy (default-deploy) to project-service-impl repository: deployment failed: repository element is not specified in POM inside distribution control element or in -DaltDeploymentRepository = id :: layout :: url parameter

It appears that, by default, the deploy:deploy target is tied to the deploy lifecycle phase. In other words, Maven will try to deploy the created artifact (the .war file in this case) to the remote repository when the deploy life cycle phase is executed.

In my case, I want to deploy the war to a remote Tomcat instance, and not to a remote Maven repository. I added the following to pom.xml

  <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.1.1</version> <configuration> <container> <containerId>tomcat6x</containerId> <type>remote</type> </container> <!-- <executions> <execution> <id>deploy-tomcat</id> <phase>deploy</phase> <goals> <goal>deploy</goal> </goals> </execution> </executions> --> <configuration> <type>runtime</type> <properties> <cargo.remote.uri>http://10.60.60.60:8080/manager</cargo.remote.uri> <cargo.remote.username>jack</cargo.remote.username> <cargo.remote.password>secret</cargo.remote.password> </properties> </configuration> <deployer> <type>remote</type> </deployer> </configuration> </plugin> 

This successfully deploys .war when running mvn cargo:deploy . However, if I then bind this target to the deploy phase of the Maven life cycle by uncommenting the <executions> element, I get the above error.

It seems that the cargo:deploy target has been added to the goals associated with the deploy phase, but I want to replace the deploy:deploy target associated with the deploy life cycle phase (default) with the cargo:deploy target, is this possible?

+4
source share
3 answers

You must bind the load to pre-integration-test instead of deploy - then your fail-safe tests can work against the deployed military file during the integration-test phase. You will run tests using mvn verify .

+3
source

You can disable plug-in deployment before configuring the load:

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.5</version> <configuration> <skip>true</skip> </configuration> </plugin> 
+1
source

You can disable the default deployment target with maven-deploy-plugin when starting the default id. Old thread, I put it here in case.

 <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.7</version> <executions> <execution> <id>default-deploy</id> <phase>none</phase> </execution> </executions> </plugin> 
+1
source

All Articles