Closed j143 closed 3 years ago
Should we use maven-release-plugin or mvn versions:set -DnewVersion=2.1.0
and mvn versions:set-scm-tag -DnewTag=v2.1.0-rc0
?
the mvn versions:set command can prepare releases?
Note: These commands are not needed, if we use maven-release-plugin
.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
With configured SCM connection, deploy to nexus repo
mvn release:clean release:prepare
mvn release:perform
For local repository:
<profile>
<id>local-repository</id>
<properties>
<altReleaseDeploymentRepository>local-nexus::default::http://localhost:8081/nexus/content/repositories/releases/</altReleaseDeploymentRepository>
<altSnapshotDeploymentRepository>local-nexus::default::http://localhost:8081/nexus/content/repositories/snapshots/</altSnapshotDeploymentRepository>
</properties>
</profile>
<activeProfiles>
<activeProfile>local-repository</activeProfile>
</activeProfiles>
<servers>
<server>
<id>local-nexus</id>
<username>deployment</username>
<password>/secret/</password>
</server>
<server>
<id>sonatype-nexus-snapshots</id>
<username>/username/</username>
<password>/secret/</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>/username/</username>
<password>/secret/</password>
</server>
</servers>
Deploying to local nexus
mvn deploy -P!local-repository
output error
$ mvn deploy -P'local-repository'
[ERROR] Error executing Maven.
[ERROR] 1 problem was encountered while building the effective settings
[FATAL] Non-parseable settings /home/user/.m2/settings.xml: start tag not allowed in epilog but got a (position: END_TAG seen ...</properties>\n</profile>\n\n<a... @9:3) @ /home/user/.m2/settings.xml, line 9, column 3
https://guides.sonatype.com/repo3/technical-guides/deployment-models/
Encountered:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (sign-release-artifacts)
mvn --batch-mode -Dtag=2.1.0-rc0 release:prepare -DreleaseVersion=2.1.0 -DdevelopmentVersion=2.1.1-SNAPSHOT -Dresume=false
Useful options to explore
dryRun
pushChanges
<scmDevelopmentCommitComment>
<scmCommentPrefix>
<scmReleaseCommitComment>
<signTag>
<tag>
<username>
<resume>
<mavenHome>
<developmentVersion>
Is it possible to pause after the release tag for tagging docs and python along with pom.xml?
No need for this. a simpler workaround will be to
# 1. Tag release version before `mvn release:prepare`
# tag python build
# change tags in docs
# 2. changes tags in pom.xml to release
# 3. changes tag in pom.xml to snapshot
mvn --batch-mode -DdryRun=false -Dtag=$RELEASE_TAG release:prepare \
-Dresume=false \
-DreleaseVersion=$RELEASE_VERSION \
-DdevelopmentVersion=$NEXT_VERSION
# 4. tag snapshot version after `mvn release:prepare`
Docs with maven pom goal
<distributionManagement>
<downloadUrl>https://bintray.com/xolstice/maven/protobuf-maven-plugin/view</downloadUrl>
<site>
<!--
release:perform checks this element to determine whether site-deploy goal needs to be run.
The actual site deployment is done by GitHub site-maven-plugin, so the URL here is not used.
-->
<id>gh-pages</id>
<url>https://github.com/xolstice/protobuf-maven-plugin/tree/gh-pages</url>
</site>
https://maven.apache.org/maven-release/maven-release-plugin/
Usage:
More:
https://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html
https://maven.apache.org/maven-release/maven-release-plugin/faq.html
https://github.com/urbanairship/mvn-python-packaging/blob/master/article.md
cleanly managing version in the build system.
https://github.com/urbanairship/mvn-python-packaging/blob/master/pom.xml
code
```xmlCan find a way to use maven version in python also?
https://github.com/j143/systemds/blob/a1a05e29f6ee78f3c33fea355f62c78ce21766ee/pom.xml#L1072-L1094