Skip to content

Instantly share code, notes, and snippets.

@chexov
Last active September 28, 2023 11:55
Show Gist options
  • Save chexov/486aea73fa9ca8976fdc35b58cf37ea2 to your computer and use it in GitHub Desktop.
Save chexov/486aea73fa9ca8976fdc35b58cf37ea2 to your computer and use it in GitHub Desktop.
Maven release plugin oneliners

Maven release plugin cheat sheet

Perform release dry run

During the dry run and again during the release proper you will be prompted for version information. The release plugin will attempt to guess the release, tag and snapshot versions. You can accept the values as is or supply your own.

mvn release:prepare -DdryRun=true

Create release tags (prepare) and let CI server build all the stuff

mvn release:clean release:prepare

Perform release locally and upload into selected maven repository (instead of CI doing this for you)

After a successful dry run, perform the release.

mvn release:clean release:prepare release:perform -Dgoals=deploy -Darguments='-DaltDeploymentRepository=vg::default::scpexe://[email protected]/storage/m2repo'

To build existing release locally and deploy it

git checkout master
git pull
git tags
git checkout seekable-io-1.0.9
mvn deploy -DaltDeploymentRepository=vg::default::scpexe://[email protected]/storage/m2repo

Skip tests during release argument

mvn release:prepare -Darguments='-Dmaven.test.skip=true'

pom.xml

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.7</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.wagon</groupId>
                        <artifactId>wagon-ssh-external</artifactId>
                        <version>2.12</version>
                    </dependency>
                </dependencies>
            </plugin>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <localCheckout>true</localCheckout>
                </configuration>
            </plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment