#How read that maven Command

25 messages · Page 1 of 1 (latest)

uncut umbra
#

Hello there, I am not a Java Programmer, I am assigned to the task of creating a CI/CD Pipeline for a somewhat messed up project. For one of the modules I have this command to build:

$APP_DIR/mvnw clean \
  pl.project13.maven:git-commit-id-plugin:revision@core-git \
  pl.project13.maven:git-commit-id-plugin:revision@db-git \
  pl.project13.maven:git-commit-id-plugin:revision@ui-git \
  install \
  spring-boot:repackage -DskipTests=true

In the documentation (https://maven.apache.org/run.html) I find this about how to run maven:

mvn [options] [<goal(s)>] [<phase(s)>]

Where in the above command is the seperation of goals and phases? And why are the options (-DskipTests=true) last? In the above command: what are the phases and what are the goals? I guess spring-boot:repackage is a goal, but in which phase does it run? Can Options , Phases and Goals be mixed and maven figures out the order?

lusty stratusBOT
#

This post has been reserved for your question.

Hey @uncut umbra! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

nocturne brook
#

if you specify a goal directly from the command-line, it doesn't run in a phase

#

but it is possible to specify goals that run in a phase

#

for example, spring-boot:repackage should run in the package phase by default

#

(and the package phase is run before the install phase)

uncut umbra
#

Does this mean: spring-boot:repackage is a goal that runs in package phase, thus, maven is additionally running the whole package phase since the plugin implies it? Or, will maven run the package phase with that single goal? Assuming there are more plugins "bound to" the package phase?

#

Or, in other words: There is no seperation of phases and goals when calling maven from the commandline, it can be mixed and phases are implied by goals anyway? So the CLI docs could look like this: mvn [option | goal | phase]??

#

One more question: Would mvn clean package be equivalent to the command above, since the plugin (spring-boot:repackage) is bound to the package phase?

nocturne brook
#

but it doesn't mean running a goal of that phase runs the whole phase

#

However, you also added the install phase to the command which requires the package phase hence it runs all goals of the package phase

nocturne brook
nocturne brook
#

For example, mvn clean someplugin:somegoal is common imo

uncut umbra
#

Thanks a lot, that really helps! One last one, if I may: How can I bind those pl… plugins to a proper phase, such they are executed aloginside?

lusty stratusBOT
nocturne brook
#

Also note that goals can also require phases to be executed before

#

I think spring-boot:repackage requires the compile phase before it

nocturne brook
#

there, you can specify the phase to bind it to, goals to execute and additional configuration that applies for the goals executed in that phase (of the specified plugin)

uncut umbra
#

Thanks a lot!!