-
Notifications
You must be signed in to change notification settings - Fork 31
User Guide
microsphere-build is a Maven build aggregation module (POM) used to manage and standardize the build process of Microsphere open-source projects. It provides unified plugin management, multi-environment profile support, resource filtering, and streamlined deployment workflows for publishing to central repositories, continuous integration (CI), code quality checks, and more.
- pom.xml: The main POM file defining common properties, plugin configurations, profiles, and dependency management.
-
src/main/java: Java source directory (usually empty as it's a parent project). -
src/main/resources: Resource configuration directory. -
src/test/...: Optional test resources or code.
Maven plugins are centrally configured with consistent versions and default settings:
| Plugin | Functionality |
|---|---|
maven-compiler-plugin |
Java compiler configuration |
maven-source-plugin |
Generate source JARs |
maven-javadoc-plugin |
Generate Javadoc documentation |
jacoco-maven-plugin |
Test coverage reports |
maven-checkstyle-plugin |
Code style enforcement |
flatten-maven-plugin |
Flatten POM for CI usage |
git-commit-id-plugin |
Inject Git commit metadata |
sign-maven-plugin / maven-gpg-plugin
|
GPG signing |
nexus-staging-maven-plugin |
Publish to Sonatype Nexus |
| Profile ID | Description |
|---|---|
release |
Used during official release; includes signing, Javadoc, GPG, etc. |
publish |
For publishing to Maven Central |
ci |
Simplified signing for CI environments |
| test | Enables unit tests and Checkstyle checks |
coverage |
Generates JaCoCo coverage report |
docs |
Builds AsciiDoc or DocBook documentation |
java8+, java9+, java11, java9-15, java16+
|
JDK compatibility adjustments |
mvn clean install -Ptest,coverage- Supports
${}placeholder replacement in bothsrc/main/javaandsrc/main/resources. - UTF-8 encoding is enforced to prevent character encoding issues.
- Supports publishing to Nexus (OSSRH) with automatic staging repository closing and releasing.
- GPG signing is supported both locally and in CI environments.
mvn deploy -PreleaseNote: You must configure credentials in
~/.m2/settings.xml.
- Uses
maven-checkstyle-pluginfor static code analysis. - Uses
jacocoto generate test coverage reports. - Uses
maven-enforcer-pluginto control dependency version conflicts.
- Supports building documentation in AsciiDoc and DocBook formats.
- Can generate HTML, PDF, and other output formats.
mvn clean installRuns compilation, packaging, and basic tests by default.
mvn clean test jacoco:report -Ptest,coveragemvn clean deploy -PreleaseEnsure your settings.xml contains the server configuration:
<servers>
<server>
<id>ossrh</id>
<username>your-sonatype-username</username>
<password>your-sonatype-password</password>
</server>
</servers>mvn install -Ddisable.checks=trueAfter the build, a Git info file will be generated at:
target/classes/git.properties
mvn generate-resources -Pdocs- Add more profiles for different environments (e.g.,
dev,staging). - Integrate with CI tools like GitHub Actions or GitLab CI for automated builds and deployments.
- Combine with SonarQube for comprehensive code analysis.
Contributions are welcome! Please refer to CONTRIBUTING.md for details.
This project is licensed under the Apache License 2.0.