gpt4 book ai didi

java - 输出组 ID :Artifact Id in the reactor instead of just the artifact id

转载 作者:行者123 更新时间:2023-11-30 11:16:55 25 4
gpt4 key购买 nike

当我运行诸如“mvn install”或“mvn validate”之类的 maven 命令时,maven 将输出它构建的所有项目的 Artifact ID。我想在脚本中使用此输出,然后调用类似于以下命令的内容:

mvn clean install -pl <comma separated list of groupId:artifactId>

不幸的是,我无法找到如何让 maven 输出组 ID 以及 Artifact ID。到目前为止,我已经梳理了 Maven react 器和依赖插件,但没有任何运气。有什么办法吗?

编辑:事实证明,如果您在 Artifact ID 前面放一个冒号,您就可以只使用 Artifact ID。例如

mvn clean install -pl :fooProject,:barProject

最佳答案

maven默认不支持这个,很难修复它会输出项目的名字

here是相关来源

private void logReactorSummary( MavenSession session )
{
logger.info( chars( '-', LINE_LENGTH ) );

logger.info( "Reactor Summary:" );

logger.info( "" );

MavenExecutionResult result = session.getResult();

for ( MavenProject project : session.getProjects() )
{
StringBuilder buffer = new StringBuilder( 128 );

buffer.append( project.getName() );
buffer.append( ' ' );

if ( buffer.length() <= MAX_PROJECT_NAME_LENGTH )
{
while ( buffer.length() < MAX_PROJECT_NAME_LENGTH )
{
buffer.append( '.' );
}
buffer.append( ' ' );
}

BuildSummary buildSummary = result.getBuildSummary( project );

if ( buildSummary == null )
{
buffer.append( "SKIPPED" );
}
else if ( buildSummary instanceof BuildSuccess )
{
buffer.append( "SUCCESS [" );
String buildTimeDuration = formatDuration( buildSummary.getTime() );
int padSize = MAX_PADDED_BUILD_TIME_DURATION_LENGTH - buildTimeDuration.length();
if ( padSize > 0 )
{
buffer.append( chars( ' ', padSize ) );
}
buffer.append( buildTimeDuration );
buffer.append( "]" );
}
else if ( buildSummary instanceof BuildFailure )
{
buffer.append( "FAILURE [" );
String buildTimeDuration = formatDuration( buildSummary.getTime() );
int padSize = MAX_PADDED_BUILD_TIME_DURATION_LENGTH - buildTimeDuration.length();
if ( padSize > 0 )
{
buffer.append( chars( ' ', padSize ) );
}
buffer.append( buildTimeDuration );
buffer.append( "]" );
}

logger.info( buffer.toString() );
}
}

如果您仍然想这样做,请检查源代码,更新此方法以输出您想要构建 maven 的方式并开始使用本地构建的 maven

关于java - 输出组 ID :Artifact Id in the reactor instead of just the artifact id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24633410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com