获取Maven装配工件的分类器/ID [英] get classifier/id of maven assembly artifact
问题描述
我们有一个运行afterSessionEnd
的Maven扩展,以获取在maven构建期间生成的所有工件细节,它使用以下命令打印每个工件的GAV
MavenSession.getAllProjects(), Artifact.getArtifact(), getAttachedArtifacts(), getGroupID(), getArtifactId(), getClassifier(), getType()
方法.
通常它可以正常工作,但是如果在maven项目中生成了任何程序集,即使使用getClassifier()
,它也不会打印该程序集工件的分类器/ID,是否也有办法获得它?
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 ?
推荐答案
发现该问题归因于有效的配置文件设置.
通过使用org.apache.maven.model.Profile getActiveProfiles(), setProperty(), setActivation()
设置会话的正确活动配置文件可以解决此问题.
现在,它提供了所有工件的所有缺少的信息,包括程序集和rpm(带有分类器).
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).
这篇关于获取Maven装配工件的分类器/ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!