Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude one of Maven's lifecycle phase

I have .war file and I need to do "deploy script". Is it possible to do this with maven? Can I execute only deploy phase of lifecycle? Or it will be better to use some other instruments for deployment like ant, gant etc.

like image 914
Sergey Avatar asked Jan 16 '12 08:01

Sergey


People also ask

How do I skip a phase in Maven?

By using the maven. test. skip property while firing the maven command for executing the phase. Skipping by default by initializing the skipTests element value to true in properties and then overriding it through the command line by mentioning the value of -DskipTests in the maven phase/build execution command.

How do you specify a valid lifecycle phase in Maven?

You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id> New! Save questions or answers and organize your favorite content. Learn more.

How do I run a specific goal in Maven?

Run a Maven goal from the context menu In the Maven tool window, click Lifecycle to open a list of Maven goals. Right-click the desired goal and from the context menu select Run 'name of the goal'. IntelliJ IDEA runs the specified goal and adds it to the Run Configurations node.

What are the three lifecycles that are built into Maven?

There are three built-in build lifecycles: default, clean and site. The default lifecycle handles your project deployment, the clean lifecycle handles project cleaning, while the site lifecycle handles the creation of your project's web site.


1 Answers

No, you can't skip phases. The mvn phase-x command always means "run all phases until phase-x, inclusive". Some plugins, however can detect if there have been changes since their last execution and decide (on their own) not to run — the subsequent build is faster.

I'm not sure what exactly you want to achieve — perhaps you could take a look at Maven assembly plugin?

like image 146
MaDa Avatar answered Sep 28 '22 21:09

MaDa