Using it
Categories:
Short explanation how to use Njord. It is totally non-invasive, but still you can integrate it as well with your project. The example below is not touching (modifying) the project it is about to publish.
Setting it up
With Maven 3 create project-wide, or with Maven 4+ create user-wide ~/.m2/extensions.xml
like this:
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>eu.maveniverse.maven.njord</groupId>
<artifactId>extension</artifactId>
<version>${currentVersion}</version>
</extension>
</extensions>
It is recommended (but not mandatory) to add this stanza to your settings.xml
as well if you don’t have it already
(to not type whole G of plugin):
<pluginGroups>
<pluginGroup>eu.maveniverse.maven.plugins</pluginGroup>
</pluginGroups>
Next, set up authentication. Different publishers require different server, for example sonatype-cp
publisher
needs following stanza in your settings.xml
:
<server>
<id>sonatype-cp</id>
<username>USER_TOKEN_PT1</username>
<password>USER_TOKEN_PT2</password>
</server>
Supported publishers and corresponding server.id
s are:
Publisher (publisher ID) | server.id | What is needed |
---|---|---|
Sonatype Central Portal (sonatype-cp ) | sonatype-cp | Obtain tokens for publishing by following this documentation. |
Sonatype OSS on https://oss.sonatype.org/ (sonatype-oss ) | sonatype-oss | Obtain tokens for publishing by following this documentation and using OSS instance. |
Sonatype S01 on https://s01.oss.sonatype.org/ (sonatype-s01 ) | sonatype-s01 | As above but using S01 instance. |
Apache RAO on https://repository.apache.org/ (apache-rao ) | apache.releases.https | As above but using RAO instance. |
Make sure your settings.xml
contains token associated with proper server.id
corresponding to you publishing service you want to use.
That’s all! No project change needed at all.
Using it
Next, let’s see an example of Apache Maven project (I used maven-gpg-plugin
):
- For example’s sake, I took last release of plugin (hence am simulating release deploy):
git checkout maven-gpg-plugin-3.2.7
- Deploy it (locally stage):
mvn -P apache-release deploy -DaltDeploymentRepository=id::njord:
(Theid
is really unused, is there just to fulfil deploy plugin syntax requirement. The URLnjord:
will use “default” store template that is RELEASE. You can target other templates by using, and is equivalent of thisnjord:release
. You can stage locally snapshots as well with URLnjord:snapshot
. Finally, you can target existing store withnjord:store:storename-xxx
). - Check staged store names:
mvn njord:list
- Optionally, check locally staged content:
mvn njord:list-content -Dstore=release-xxx
(use store name from above) - Optionally, validate locally staged content:
mvn njord:validate -Ddetails -Dstore=release-xxx
(use store name from above) - Publish it to ASF:
mvn njord:publish -Dstore=release-xxx -Dtarget=apache-rao
(use store name from above) - From now on, the repository is staged on RAO, so you can close it, vote, and on vote pass, release it. All the usual fluff as before.
- Drop locally staged store:
mvn njord:drop -Dstor=release-xxx
(use store name from above)
Check out Maven generated plugin documentation for more mojos.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.