This repository provides an assembly template for maven project in combination with the Central Staging Plugins, help to generate a deployment bundle compatible with the Sonatype Central Portal.
- Complete Maven Configuration: Pre-configured POM with all required metadata for Maven Central
- Assembly Configuration: Custom assembly descriptor for creating Central Portal compatible bundles
- Code Signing: GPG signing configuration for artifact authentication
- Documentation: Automated javadoc and sources jar generation
- Checksums: SHA1 and MD5 checksum generation for all artifacts
- Validation: Example Java classes and unit tests
├── pom.xml # Main Maven configuration
├── src/
│ ├── assembly/
│ │ └── full.xml # Assembly descriptor for bundle creation
│ ├── main/java/ # Source code
│ └── test/java/ # Unit tests
├── .github/
│ └── workflows/
│ ├── build.yml # Build and test workflow
│ └── publish-to-central.yml # Publishing workflow
└── target/ # Build artifacts and generated bundles
Before using this template, ensure you have:
- Java 17+: Required for building the project
- Maven 3.9+: For project management and building
- GPG Key: For signing artifacts (see Central Portal Requirements)
- Central Portal Account (Optional): Register at Central Portal
git clone https://github.com/eclipse-cbi/central-staging-plugins-assembly-template.git
cd central-staging-plugins-assembly-templateEdit the pom.xml file to match your project:
groupId: Your organization's group IDartifactId: Your project's artifact IDversion: Your project versionnameanddescription: Project metadataurl: Project website/repository URLlicenses: Project license informationdevelopers: Developer informationscm: Source control management URLs
mvn clean installThis will generate:
- Main JAR file
- Sources JAR
- Javadoc JAR
- GPG signatures (.asc files)
- Checksums (MD5 and SHA1)
- Deployment bundle (ZIP file)
This template is specifically designed for the bundle upload method to the Central Portal:
-
Build the bundle:
mvn clean install
-
Locate the bundle: The generated bundle will be in
target/with the naming pattern:{artifactId}-{version}-bin.zip -
Upload to Central Portal:
Option A: Web Interface
- Visit Central Portal
- Navigate to "Upload Bundle"
- Upload your generated ZIP file
- Follow the validation and publishing workflow
Option B: Command Line
mvn central-staging-plugins:rc-upload \ -Dcentral.automaticPublishing=true \ -Dcentral.artifactFile=./target/<my_bundle>-bin.zip \ -Dcentral.bearerToken="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Replace
<my_bundle>with your actual bundle name and provide your Central Portal bearer token.Option C: GitHub Actions (Recommended)
This template includes GitHub Actions workflows for automated publishing:
- Build Workflow (
.github/workflows/build.yml): Runs on every push/PR to validate the project - Publish Workflow (
.github/workflows/publish-to-central.yml): Publishes to Central Portal on version tags
To use GitHub Actions publishing:
-
Configure GitHub Secrets:
GPG_PRIVATE_KEY: Your GPG private key (base64 encoded)GPG_PASSPHRASE: Your GPG key passphraseCENTRAL_SONATYPE_TOKEN_USERNAME: Your Central Portal username (optional)CENTRAL_SONATYPE_TOKEN_PASSWORD: Your Central Portal password (optional)CENTRAL_BEARER_TOKEN: Your Central Portal bearer token
-
Create a release:
- Go to your GitHub repository
- Navigate to "Releases" and click "Create a new release"
- Create a tag (e.g.,
v1.0.0) and publish the release - The workflow will automatically trigger
-
Monitor the workflow: Check the Actions tab in your GitHub repository
The generated bundle includes all required artifacts as specified in the Central Portal requirements:
- Main JAR: Your compiled application
- Sources JAR: Source code archive
- Javadoc JAR: Generated documentation
- POM file: Project metadata
- GPG Signatures:
.ascfiles for all artifacts - Checksums: MD5 and SHA1 hashes for verification
Before uploading, verify your bundle contains:
unzip -l target/{artifactId}-{version}-bin.zipExpected structure:
`-- com
`-- sonatype
`-- central
`-- example
`-- example_java_project
`-- 0.1.0
|-- example_java_project-0.1.0-javadoc.jar
|-- example_java_project-0.1.0-javadoc.jar.asc
|-- example_java_project-0.1.0-javadoc.jar.md5
|-- example_java_project-0.1.0-javadoc.jar.sha1
|-- example_java_project-0.1.0-sources.jar
|-- example_java_project-0.1.0-sources.jar.asc
|-- example_java_project-0.1.0-sources.jar.md5
|-- example_java_project-0.1.0-sources.jar.sha1
|-- example_java_project-0.1.0.jar
|-- example_java_project-0.1.0.jar.asc
|-- example_java_project-0.1.0.jar.md5
|-- example_java_project-0.1.0.jar.sha1
|-- example_java_project-0.1.0.pom
|-- example_java_project-0.1.0.pom.asc
|-- example_java_project-0.1.0.pom.md5
`-- example_java_project-0.1.0.pom.sha1see: https://central.sonatype.org/publish/publish-portal-upload/
- Central Portal Documentation
- Maven Central Requirements
- Central Portal Publishing Guide
- GPG Signing Guide
Eclipse Public License v.2.0 (LICENSE)
Contributions are welcome! Please read CONTRIBUTING.md for guidelines on how to contribute to this project.