How can I get a list of GAVs a maven package command will produce?

后端 未结 1 1132
刺人心
刺人心 2021-01-25 13:58

I\'m looking for a (supported) mvn based command, which will give me a list of all the GroupID:ArtifactID:Version (GAV) for all artifacts that running a mvn p

1条回答
  •  终归单人心
    2021-01-25 14:06

    In general you can't produce a list before the build has run...The problem is that based on the pom model not all artifacts are described, cause some plugins can produce supplemental artifacts (maven-assembly-plugin, maven-shade-plugin, maven-jar-plugin via test-jar etc.)

    What you can make is to get a list of produced artifacts after a build has run..(installed). The question of yours inspired me to implement an EventSpy which produces such list at the end of the build...which looks like this:

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 4.423 s
    [INFO] Finished at: 2016-05-08T13:22:10+02:00
    [INFO] Final Memory: 24M/310M
    [INFO] ------------------------------------------------------------------------
    [INFO] --             Maven Artifact Collector Summary                       --
    [INFO] ------------------------------------------------------------------------
    [INFO] test.maven.plugin.profiler:parse-pom:0.1.0-SNAPSHOT:jar
    [INFO] test.maven.plugin.profiler:parse-pom:0.1.0-SNAPSHOT:pom
    [INFO] test.maven.plugin.profiler:parse-pom:0.1.0-SNAPSHOT:jar:jar-with-dependencies
    

    What i can do is to enhance that and write a file which contains the information (in more or less any format)...At the moment it's just a PoC...May be you can give some more information or create issues or PR's and request what might be needed...may be this is also interesting for others...

    Furthermore your downstream part must have those artifacts within a repository cache available (either on a file system or via a repository manager or docker data container)...

    0 讨论(0)
提交回复
热议问题