Maven
Overview
Maven is a build automation and dependency management tool for Java projects. It uses a Project Object Model (POM) to manage project builds, dependencies, and documentation.
Integrating Maven with JFrog Fly allows you to manage your artifacts and releases from source code to production in a simple and native way, directly from your IDE.
Supported Clients
JFrog Fly supports Maven artifacts with:
- Maven CLI (
mvn deploy,mvn install) - The standard Apache Maven build tool
Upload / Deploy Artifact
With Fly App
Activate Maven in your Fly App to configure Maven globally with Fly, then deploy as usual:
mvn clean deployManual Configuration
1. Generate an access token in Fly Token Management
2. Configure Maven credentials by editing ~/.m2/settings.xml:
<settings>
<servers>
<server>
<id>fly-maven</id>
<username><your-fly-username></username>
<password><your-fly-token></password>
</server>
</servers>
<profiles>
<profile>
<id>fly</id>
<repositories>
<repository>
<id>fly-maven</id>
<url>https://<your-fly-subdomain>.jfrog.io/artifactory/maven</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>fly</activeProfile>
</activeProfiles>
</settings>3. Configure your project’s pom.xml - add the distribution management section:
<distributionManagement>
<repository>
<id>fly-maven</id>
<url>https://<your-fly-subdomain>.jfrog.io/artifactory/maven</url>
</repository>
<snapshotRepository>
<id>fly-maven</id>
<url>https://<your-fly-subdomain>.jfrog.io/artifactory/maven</url>
</snapshotRepository>
</distributionManagement>Note: The
<id>value (fly-maven) must match the server id in yoursettings.xml.
4. Deploy artifact:
mvn clean deployDownload / Install Dependencies
With Fly App
Activate Maven in your Fly App to configure Maven globally with Fly, then install as usual:
mvn clean installManual Configuration
1. Generate an access token in Fly Token Management
2. Configure Maven by editing ~/.m2/settings.xml as shown in the Deploy section above.
3. Install dependencies:
mvn clean installFrom Public Registry
When you install a dependency that isn’t in your Fly Registry, JFrog Fly automatically fetches it from Maven Central and caches it for future use.
mvn clean installUpload/Download Artifacts with CI
To deploy and install Maven artifacts with CI, update your GitHub Actions workflow to include the Fly action.
Simply type in your IDE the prompt: “Configure my workflows with Fly” and Fly MCP will configure your GitHub Actions workflow yml file, as follows:
1. Add permissions (top level, after on:):
permissions:
contents: read
id-token: write2. Add Fly Action (after actions/setup-java, before Maven commands):
- name: JFrog Fly - Configure all your package managers to work with Fly registry
uses: jfrog/fly-action@v1
with:
url: https://<your-fly-subdomain>.jfrog.ioGitHub Action Example
name: Build and Deploy Maven Artifact
on:
push:
branches: [main]
permissions:
contents: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: JFrog Fly - Configure all your package managers to work with Fly registry
uses: jfrog/fly-action@v1
with:
url: https://<your-fly-subdomain>.jfrog.io
- name: Build with Maven
run: mvn clean package
- name: Deploy to Fly
run: mvn deployBack to Package Types →