Search code examples
javamavenmaven-3

get classifier/id of maven assembly artifact


We have a Maven extension which runs afterSessionEnd to get all the artifacts details generated during the maven build, it prints GAV of each artifact using MavenSession.getAllProjects(), Artifact.getArtifact(), getAttachedArtifacts(), getGroupID(), getArtifactId(), getClassifier(), getType() methods. It works fine generally, but if there are any assemblies being generated in the maven project it doesn't print classifier/ID of that assembly artifact even though using getClassifier(), Is there any way to get it also ?


Solution

  • Found that problem was due to active profile setup.
    It is fixed by setting up the correct active profile of the session, using org.apache.maven.model.Profile getActiveProfiles(), setProperty(), setActivation()
    and now it gives all the missing info for all the artifacts including assemblies and rpm's (with classifiers).