Java
Build actions for Java projects using Apache Maven.
Available Actions
| Action | Description |
|---|---|
java-maven-setup | Install Java and Maven |
java-maven-repository-login | Configure Maven repositories |
java-maven-build | Build and test |
java-maven-cut-tag | Bump version and create tag |
java-maven-repository-publish | Deploy to Maven repository |
Version File
Maven reads and writes versions in pom.xml:
<project>
<groupId>com.example</groupId>
<artifactId>my-service</artifactId>
<version>1.2.3</version>
</project>
Example Usage
steps:
- uses: actions/checkout@v4
- uses: p6m-actions/java-maven-setup@v1
with:
java-version: '21'
- uses: p6m-actions/java-maven-repository-login@v1
with:
server-id: artifactory
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_IDENTITY_TOKEN }}
- uses: p6m-actions/java-maven-build@v1
- uses: p6m-actions/java-maven-repository-publish@v1
Dockerfile
note
Dockerfile patterns depend on your specific project structure. Java projects typically use a Dockerfile that copies the JAR built by Maven.
See Containerization for general patterns including:
- Multi-stage builds vs copying pre-built artifacts
- Non-root user configuration
- Health check setup
Related
- Java Setup Guide - Local development environment
- Containerization - General container patterns