简体   繁体   English

Maven发布插件,带有来自命令行的classifer快照依赖项

[英]Maven release plugin with classifer snapshot dependencies from command line

I'm attempting to run the maven release plugin from the command line in batch mode for a multi-module project that has dependences that are deployed to the maven repository with a classifier. 我正在尝试以批处理模式从命令行运行maven release插件,以获得一个多模块项目,该项目具有使用分类器部署到maven存储库的依赖项。

The release:prepare works correctly when it's not in batch-mode and prompts for all the unresolved snapshot dependences including the ones with a classifier and the release completes successfully. release:prepare在不处于批处理模式时正常工作,并提示所有未解析的快照依赖项,包括具有分类器且发布成功完成的快照依赖项。

When I look at the release.properties file I see ... 当我查看release.properties文件时,我看到......

Regular dependencies identified like 常规依赖关系被识别为

project.rel.groupIdXYZ:artifactIdXYZ=2.0.3.4
project.dev.groupIdXYZ:artifactIdXYZ=2.0.3.4-SNAPSHOT

Classifier dependencies identified like 分类器依赖关系标识为

dependency.groupIdABC:artifactIdABC.release=2.0.3.4
dependency.groupIdABC:artifactIdABC.development=2.0.3.4-SNAPSHOT

with no actual classifier id. 没有实际的分类器ID。

Now I try it through the command line with a command line like ... 现在我通过命令行尝试使用命令行,如...

mvn --batch-mode -P release,nexus -Dtag=rm2.0.3.4 -Dproject.rel.groupIdXYZ:artifactIdXYZ=2.0.3.4 -Dproject.dev.groupIdXYZ:artifactIdXYZ=2.0.3.4-SNAPSHOT -Ddependency.groupIdABC:artifactIdABC.development=2.0.3.4-SNAPSHOT -Ddependency.groupIdABC:artifactIdABC.release=2.0.3.4 -DreleaseVersion=2.0.3.4 -DdevelopmentVersion=2.0.3.4-SNAPSHOT -DdryRun=true release:prepare

and get 得到

Can't release project due to non released dependencies :
groupIdABC:artifactIdABC:jar:classifierIdABC:2.0.3.3-SNAPSHOT:compile

I've verified that the classifier artifacts are in my local maven repo our corporate central maven repo. 我已经验证了分类器工件是我当地的maven repo我们的公司中央maven repo。 I've tried specifing the classifier artifacts as 我已经尝试将分类器工件指定为

-Dproject.rel.groupIdABC:artifactIdABC:jar:classifierIdABC=2.0.3.4

and still the same error. 仍然是同样的错误。

Any pointers to being able to run this from the command line would be appreciated. 任何能够从命令行运行它的指针都将受到赞赏。

What if you set allowTimestampedSnapshots property to true ? 如果将allowTimestampedSnapshots属性设置为true怎么办? Does it still throw the error? 它仍然抛出错误吗?

maven-release-plugin requires all dependency versions to be non-SNAPSHOT ... for obvious reasons. maven-release-plugin要求所有依赖版本都是非SNAPSHOT ...原因很明显。 Must be final release. 必须是最终版本。

If you know your dependencies do have non-SNAPSHOT versions available, (you previously released them), then you could use versions-maven-plugin to automatically update the pom.xml 如果您知道您的依赖项确实有非SNAPSHOT版本可用(您之前发布过它们),那么您可以使用versions-maven-plugin自动更新pom.xml

mvn versions:use-latest-versions -DallowSnapshots=false -Dincludes=com.my.*

And to prevent release-plugin from complaining about the uncommitted change to the pom.xml... 并防止release-plugin抱怨对pom.xml的未提交更改...

 mvn release:prepare ... -DcheckModificationExcludeList=pom.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM