9.6. Managing Staging Rulesets

Nexus Professional has the ability to define staging rules that must be satisfied before a staging repository can be promoted.

9.6.1. Managing Staging Rulesets

Staging Rulesets are groups of rules that are applied to a Staging repository at promotion time. A staging repository associated with a staging ruleset cannot be promoted until all of the rules associated with the rulesets have been satisfied. This feature allows you to set standards for your own hosted repositories, and it is the mechanism that is used to guarantee the consistency of artifacts stored in the Central Maven repository.

Nexus Professional contains the following rules:

Staging Javadoc Validation

The Staging Javadoc Validation rule will verify that every project has an artifact with the javadoc classifier. If you attempt to promote a staging repository which contains artifacts not accompanied by "-javadoc.jar" artifacts, this validation rule will fail.

Staging POM Validation

The Staging POM Validation rule will verify the following properties of all POMs to be promoted:

  • Project URL - project/url

  • Project Licenses - project/licenses

  • Project SCM Information - project/scm

If any of these POM elements are missing or empty, this Staging Ruleset will cause a promotion to fail.

Staging Signature Validation

The Staging Signature Validation rule verifies that every item in the repository has a valid PGP signature. If you attempt to promote a staging repository which contains artifacts not accompanied by valid PGP signature, this validation will fail.

Staging Sources Validation

The Staging Sources Validation rule will verify that every project has an artifact with the sources classifier. If you attempt to promote a staging repository which contains artifacts not accompanied by "-sources.jar" artifacts, this validation rule will fail.

To create a Staging Ruleset, click on the Staging Ruleset link in the Nexus Menu. This will load the interface shown in Figure 9.8, “Creating a Staging Ruleset”. The Staging Ruleset panel is used to define sets of rules that can be applied to Staging Profiles. Figure 9.8, “Creating a Staging Ruleset” shows a ruleset which contains all four predefined staging rules.

Creating a Staging Ruleset

Figure 9.8. Creating a Staging Ruleset


9.6.2. Defining Rulesets for Promotion

To define a ruleset to be used for promotion, click on Staging in the Nexus menu and select a Staging Profile. Click on the Configuration tab, and scroll down to the Promote Repository Staging Rulesets section of the Staging Profile configuration as shown in Figure 9.9, “Associating a Staging Ruleset with a Staging Profile”. The next time you attempt to promote a staging repository that was created with this profile, Nexus Professional will check that all of the rules in the associated rulesets are being adhered to.

Associating a Staging Ruleset with a Staging Profile

Figure 9.9. Associating a Staging Ruleset with a Staging Profile