问题
Is there a way to create a list of all artifacts that are created by running
mvn clean install
similar to the output of :
mvn mvn dependency:tree/list
回答1:
There is a way to do that:
mvn -q -Dexec.executable='echo' -Dexec.args='${project.groupId} ${project.version} ${project.artifactId} ${project.packaging}' --non-recursive exec:exec
If you want it for all artifacts in your project including sub-folders remove --non-recursive
.
回答2:
It can be achieved by writing a maven extension by extending org.apache.maven.AbstractMavenLifecycleParticipant
which will run at the end of maven build afterSessionEnd
and using MavenSession.getAllProjects(), Artifact.getArtifact(), getAttachedArtifacts(), getGroupID(), getArtifactId(), getClassifier(), getType()
you can loop through all the projects and get the details for each artifact generated.
make sure to set the correct profile(if you have any) to not miss any info about the artifacts like reported here get classifier/id of maven assembly artifact
来源:https://stackoverflow.com/questions/36936238/create-a-list-of-artifacts-that-are-build-by-a-maven-project