简体   繁体   中英

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.

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.

When I look at the release.properties file I see ...

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.

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. 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 ? Does it still throw the error?

maven-release-plugin requires all dependency versions to be non-SNAPSHOT ... for obvious reasons. 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

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...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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