Questions tagged [maven-lifecycle]

For questions regarding the different lifecycle stages and their execution phases in building projects with Apache Maven.

For questions regarding the different lifecycle stages and their execution phases in building projects with Apache Maven.

Maven is based around the central concept of a build lifecycle. What this means is that the process for building and distributing a particular artifact (project) is clearly defined.

For the person building a project, this means that it is only necessary to learn a small set of commands to build any Maven project, and the POM will ensure they get the results they desired.

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.

Each of these build lifecycles is defined by a different list of build phases, wherein a build phase represents a stage in the lifecycle.

For example, the default lifecycle comprises of the following phases (for a complete list of the lifecycle phases, refer to the Lifecycle Reference):

  • validate - validate the project is correct and all necessary information is available
  • compile - compile the source code of the project
  • test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package - take the compiled code and package it in its distributable format, such as a JAR.
  • verify - run any checks on results of integration tests to ensure quality criteria are met
  • install - install the package into the local repository, for use as a dependency in other projects locally
  • deploy - done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.

See for all details the source of the above text: https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

28 questions
1
vote
1 answer

Maven enforcer plugin and missing dependencies

Here is a minimal project:
zolv
  • 1,720
  • 2
  • 19
  • 36
0
votes
0 answers

Maven: commands of the lifecycle

Please tell me how to run the maven LifeCycle commands through Terminal? If you write mvn clean or mvn compile, then the commands belonging to the maven plugin are run. The result of their execution does not correspond to the commands of the…
Mary
  • 35
  • 5
0
votes
1 answer

Maven assembly plugin zips the jar.original content and not the executable jar

How to pack the executable jar in zip using maven-assembly-plugin and not the Original file i.e. .jar.original Currently, on providing maven-assembly-plugin as dependency, it packs the jar.original in the zip. maven-assembly-plugin definition …
0
votes
1 answer

What is the difference between mvn pre-clean / clean / post-clean?

what is the difference between these 3 commands: mvn pre-clean / clean / post-clean? Pre and post are unusual to be used. We go straight forward with mvn clean but why?
35Zoll
  • 23
  • 3
0
votes
1 answer

Maven Mojo does not utilize the reactor when called through a phase. It works fine when called as independent goal

I have implemented a custom maven mojo to perform some operation on all modules mentioned in the input POM. The mojo works as expected when called from command line like: mvn plugin_group_id:artifact_id:version:mojo_goal_name but it doesn't work…
vivek
  • 386
  • 3
  • 12
0
votes
0 answers

Is maven having any life cycle to run scripts?

I want to know whether maven has different lifecycle for run scripts . please help me to know the answer to this question "Is maven having any life cycle to run scripts?"
dee29
  • 1
  • 1
0
votes
2 answers

Unknown lifecycle phase "run". You must specify a valid lifecycle phase

[ERROR] Unknown lifecycle phase "run". You must specify a valid lifecycle phase or a goal in the format
gurchet singh
  • 21
  • 1
  • 4
0
votes
0 answers

Maven Ant run something at the end of the build

I have a Maven parent project that has 6 modules, each module generates a specific artifact that is copied somewhere, when all the modules are built I want to be able to run an ant task that commits and pushes these artifacts into its GIT…
bajistaman
  • 62
  • 8
0
votes
1 answer

Custom Lifecycle breaks Surefire:test in Maven

I have a plugin that creates a special zip file as part of the build process. To do this it defines a custom packaging type 'wcc' and a custom life cycle to go with it. When I run mvn package the applicaton builds my zip file just fine and…
Raystorm
  • 6,180
  • 4
  • 35
  • 62
0
votes
0 answers

Clean lifecycle in Travis CI Maven build

When I review .travis.yml configs I very often see mvn clean verify or mvn clean install. Is there any point in invoking clean lifecycle in the Travis CI builds when it is first invocation of mvn in script? Are there any cases when clean might be…
Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
0
votes
0 answers

Maven lifecycle wrong order

I deploy my application during the package phase: org.glassfish.maven.plugin maven-glassfish-plugin 2.1
matthias
  • 1,938
  • 23
  • 51
0
votes
1 answer

does maven profile configured for integration phase execute during build life cycle?

Here is the condensed snippet of pom.xml from my project run-tests
brain storm
  • 30,124
  • 69
  • 225
  • 393
-1
votes
2 answers

How do you properly execute "mvn clean" inside a project?

I'm trying to clean, build, and package my project, but I keep getting this error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean (auto-clean) on project Presentation: Unable to parse configuration of mojo…
Mark Roberts
  • 55
  • 1
  • 9
1
2