Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there a way to use the deploy phase to perform some tasks without maven trying to install the artifact to a maven repository?

0
Posted

Is there a way to use the deploy phase to perform some tasks without maven trying to install the artifact to a maven repository?

0

If you run ‘mvn deploy’, the ‘maven-deploy-plugin’ kicks in. There’s no flag that tells it not to upload the file. So you’d have to make a new lifecycle mapping/packaging for each of artifact in your project. There’s no way to ‘delete’ mojo’s from the default lifecycle. What you could do is specify the remote repo as file:///tmpor something. Usually people want to ‘upload’ a war to the tomcat webapps dir, also known as deploying. That kind of deploying is not something m2 has a phase for. What you can do is create a profile in the pom (or super pom), and add a task/mojo to the ‘install’ phase. For instance, you can have the antrun plugin copy the artifact to the tomcat directory (its location specified in settings.xml). The profile is named ‘dev’, so whenever you want to deploy a war, you just type ‘mvn install -Pdev’. Don’t bind to the deploy phase, but to the install or package phase.

0

If you run ‘mvn deploy’, the ‘maven-deploy-plugin’ kicks in. There’s no flag that tells it not to upload the file. So you’d have to make a new lifecycle mapping/packaging for each of artifact in your project. There’s no way to ‘delete’ mojo’s from the default lifecycle. What you could do is specify the remote repo as file:///tmp or something. Usually people want to ‘upload’ a war to the tomcat webapps dir, also known as deploying. That kind of deploying is not something m2 has a phase for. What you can do is create a profile in the pom (or super pom), and add a task/mojo to the ‘install’ phase. For instance, you can have the antrun plugin copy the artifact to the tomcat directory (its location specified in settings.xml). The profile is named ‘dev’, so whenever you want to deploy a war, you just type ‘mvn install -Pdev’. Don’t bind to the deploy phase, but to the install or package phase.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123