Skip to content

Conversation

@agrasth
Copy link
Collaborator

@agrasth agrasth commented Sep 28, 2025

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • All static analysis checks passed.
  • Appropriate label is added to auto generate release notes.
  • I used gofmt for formatting the code before submitting the pull request.
  • PR description is clear and concise, and it includes the proposed solution/fix.

Maven FlexPack Support with Build Info Collection and Artifact Property Setting

Overview

This PR implements comprehensive Maven FlexPack support in jfrog-cli-artifactory, enabling native Maven execution with complete build info collection, deployed artifact tracking, and build property setting. The implementation follows the established Poetry FlexPack pattern for consistency and maintainability.

Key Features

🚀 Native Maven Execution

  • Execute Maven commands natively with JFROG_RUN_NATIVE=true
  • Seamless integration with existing JFrog CLI workflows
  • Full compatibility with standard Maven commands (compile, install, deploy, etc.)

📊 Complete Build Info Collection

  • Dependencies: Collects all Maven dependencies with proper scopes (compile, runtime, test, provided, system, import)
  • Checksums: Calculates MD5, SHA1, and SHA256 checksums for all dependencies
  • Artifacts: Includes deployed JAR and POM artifacts in build info
  • Metadata: Captures Maven coordinates, versions, and dependency relationships

🏷️ Build Property Setting

  • Automatically sets build.name, build.number, and build.project properties on deployed artifacts
  • Only executes for deploy commands (not compile, install, etc.)
  • Follows the same pattern as Twine for consistency
  • Enables artifact traceability and build correlation

🔄 Build Info Publishing

  • Saves build info in format compatible with jf rt bp
  • Maintains consistency with existing build info structure
  • Supports project-based build info organization

Implementation Details

Architecture

The implementation follows the Poetry FlexPack pattern exactly:

Maven Pattern (New):
jf mvn deploy --build-name=test --build-number=1
├── buildtools/cli.go → MavenCmd()
├── maven/maven.go → Run()
└── flexpack.NewMavenFlexPack() → CollectBuildInfo()

File Structure

jfrog-cli-artifactory/
└── artifactory/commands/flexpack/
└── maven.go (280 lines) - Essential Maven FlexPack functionality

Usage Examples

Basic Maven Deploy with Build Info

export JFROG_RUN_NATIVE=true
jf mvn deploy --build-name=my-maven-build --build-number=1
jf rt bp my-maven-build 1

Maven Install (No Deployment)

export JFROG_RUN_NATIVE=true
jf mvn install --build-name=my-maven-build --build-number=1
# Only dependencies collected, no artifacts or properties set

Related PRs:

- Move FlexPack command handling to jfrog-cli-artifactory
- Add HandleFlexPackCommand and IsPackageManagerCommand functions
- Create flexpack package with command execution and build info logic
- Refactor business logic out of main jfrog-cli repo
@agrasth agrasth force-pushed the maven-flexpack-refactor branch from bf36546 to 9e86ccf Compare October 6, 2025 06:22
@agrasth agrasth merged commit 2929fd8 into jfrog:main Oct 6, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant