Skip to content

A maven mixin for releasing modules using Sonatype OSS repository

Notifications You must be signed in to change notification settings

danhaywood/java-mavenmixin-sonatyperelease

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-mavenmixin-sonatyperelease

Tip

UNFORTUNATELY, THIS DOESN’T SEEM TO WORK…​

Instead, need to inline the contents; see for example danhaywood/java-mavenmixin-datanucleusenhance

This module provides a maven mixin that can be incorporated into any Maven module that is to be released through the Sonatype OSS repository. This reduces the size of the maven pom.xml file for that consuming module; it simply needs to reference this module using the mixin-maven-plugin.

The appropriate configuration is included in a <profile> which can be activated using the -P option on the mvn command line.

How to Configure/Use

To use:

  • add the following to the pom.xml of the module(s) containing the JDO/DataNucleus entities:

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.odavid.maven.plugins</groupId>
                <artifactId>mixin-maven-plugin</artifactId>
                <version>0.1-alpha-39</version>
                <extensions>true</extensions>
                <configuration>
                    <mixins>
                        <mixin>
                            <groupId>com.danhaywood.mavenmixin</groupId>
                            <artifactId>sonatyperelease</artifactId>
                            <version>0.0.1</version>
                        </mixin>
                    </mixins>
                </configuration>
            </plugin>
        </plugins>
    </build>

The module can be activated using the -P flag; for example:

 mvn clean deploy                            \
     -Pdanhaywood-mavenmixin-sonatyperelease \
     -Dpgp.secretkey=keyring:id=$KEYID       \
     -Dpgp.passphrase="literal:$PASSPHRASE"

where $KEYID and $PASSPHRASE correspond to the credentials used for publishing via Sonatype OSS.

Tip

For details on how to set up a domain name to publish via Sonatype OSS, see this user guide and also this blog post I wrote up a while back.

Known issues

None currently

Change Log

  • 0.0.1 - first release

License

Copyright 2016~date Dan Haywood

Licensed under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

Dependencies

This mixin module relies on the com.github.odavid.maven.plugins:mixin-maven-plugin, released under Apache License v2.0.

Maven deploy notes

The module is deployed using Sonatype’s OSS support (see user guide and this blog post).

The release.sh script automates the release process. It performs the following:

  • performs a sanity check (mvn clean install -o) that everything builds ok

  • bumps the pom.xml to a specified release version, and tag

  • performs a double check (mvn clean install -o) that everything still builds ok

  • releases the code using mvn clean deploy

  • bumps the pom.xml to a specified release version

For example:

sh release.sh 0.0.1 \
              0.0.2-SNAPSHOT \
              dan@haywood-associates.co.uk \
              "this is not really my passphrase"

where

  • $1 is the release version

  • $2 is the snapshot version

  • $3 is the email of the secret key (~/.gnupg/secring.gpg) to use for signing

  • $4 is the corresponding passphrase for that secret key.

Other ways of specifying the key and passphrase are available, see the pgp-maven-plugin's documentation).

If the script completes successfully, then push changes:

git push origin master
git push origin 0.0.1

If the script fails to complete, then identify the cause, perform a git reset --hard to start over and fix the issue before trying again. Note that in the dom’s `pom.xml the nexus-staging-maven-plugin has the autoReleaseAfterClose setting set to true (to automatically stage, close and the release the repo). You may want to set this to false if debugging an issue.

According to Sonatype’s guide, it takes about 10 minutes to sync, but up to 2 hours to update search.

About

A maven mixin for releasing modules using Sonatype OSS repository

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages