Skip to content

Added Maven native implementation using flexpack#3081

Merged
agrasth merged 17 commits intojfrog:masterfrom
agrasth:mavenFlexpack
Oct 6, 2025
Merged

Added Maven native implementation using flexpack#3081
agrasth merged 17 commits intojfrog:masterfrom
agrasth:mavenFlexpack

Conversation

@agrasth
Copy link
Contributor

@agrasth agrasth commented Sep 11, 2025

  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the dev branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

Add FlexPack Maven Support to JFrog CLI

Summary

Implements native FlexPack Maven support in JFrog CLI, leveraging the FlexPack implementation from build-info-go to provide enhanced build info collection and artifact management for Maven projects.

Changes Made

FlexPack Integration

  • Added FlexPack Maven test coverage in maven_test.go
  • Integrated with build-info-go FlexPack implementation for native Maven support
  • Added tests for FlexPack build info collection and artifact deployment
  • Implemented build properties validation for FlexPack-deployed artifacts

Test Enhancements

  • TestMavenBuildWithFlexPack: Validates FlexPack artifact deployment
  • TestMavenBuildWithFlexPackBuildInfo: Tests build info collection with dependency tracking
  • TestMavenFlexPackBuildProperties: Verifies build properties are correctly set on artifacts
  • Added comprehensive dependency validation (checksums, scopes, types)

Dependencies

  • Utilizes FlexPack implementation from build-info-go repository
  • Requires JFROG_RUN_NATIVE=true environment variable for FlexPack execution

Files Modified

  • jfrog-cli/maven_test.go - Added FlexPack test coverage and fixed linting issues

@agrasth agrasth added the improvement Automatically generated release notes label Sep 11, 2025
@agrasth agrasth added the safe to test Approve running integration tests on a pull request label Sep 14, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 14, 2025
@agrasth agrasth changed the base branch from dev-deprecated-please-target-master-directly to master September 16, 2025 07:15
@agrasth agrasth added the safe to test Approve running integration tests on a pull request label Sep 16, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 16, 2025
buildInstance, err := buildInfoService.GetOrCreateBuildWithProject(
buildInfo.Name,
buildInfo.Number,
"", // project key - can be empty for now
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we pass projectKey that is available with buildInfoService?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! will add this.

// Get deployment repository from configuration
deployRepo := getDeploymentRepoFromConfig(workingDir)
if deployRepo == "" {
deployRepo = "maven-flexpack-local" // fallback
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use Const for storing hardcoded strings.

// Also check for POM file (deployed by Maven from project root)
pomPatterns := []string{
"pom.xml", // The original POM file that Maven deployed
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only file inside slice? Are we expecting more files to be added inside it? If no, then no need of slice.

@agrasth agrasth force-pushed the mavenFlexpack branch 2 times, most recently from f75cff3 to 3cfdf8d Compare September 22, 2025 20:25
@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Sep 22, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 22, 2025
@agrasth agrasth requested review from bhanurp September 24, 2025 11:11
@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Sep 24, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 24, 2025
@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Sep 29, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 29, 2025
@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Sep 29, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 29, 2025
@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Sep 30, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 30, 2025
@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Sep 30, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Sep 30, 2025
- Move FlexPack command handling from main.go to jfrog-cli-artifactory
- Remove business logic functions (runNativeImplementation, RunActions, etc.)
- Simplify main.go to focus on CLI routing only
- Keep minimal import for GetJfrogCliArtifactoryApp compatibility
- Successfully builds and runs basic CLI functionality

This follows the established pattern where:
- jfrog-cli: Command routing and CLI setup
- jfrog-cli-artifactory: Business logic for Artifactory commands
- build-info-go: Core FlexPack implementations
- Remove artifact verification from TestMavenBuildWithFlexPack and TestMavenBuildWithFlexPackBuildInfo
- FlexPack with 'install' correctly only installs to local repository
- Traditional Maven Build Info Extractor auto-deploys during install, but FlexPack follows pure Maven behavior
- TestMavenFlexPackBuildProperties still uses 'deploy' and expects artifacts (correct)
…nstall

- FlexPack follows standard Maven behavior where 'install' only installs to local repository
- Traditional Maven Build Info Extractor auto-deploys during install (non-standard)
- Updated test to not expect artifacts in build info when using 'install' with FlexPack
- This aligns with the correct Maven semantics that FlexPack implements
- FlexPack uses pure Maven which requires proper <distributionManagement> in POM
- Traditional Maven Build Info Extractor bypasses this requirement
- Test POM doesn't have deployment configuration, causing 'mvn deploy' to fail
- This is expected behavior for FlexPack - it follows standard Maven semantics
- Resolved conflicts in go.mod and go.sum
- Kept local development paths for build-info-go and jfrog-cli-artifactory
- Updated to latest upstream dependencies
- Removed obsolete FlexPack comments that are no longer needed
- Removed duplicate CommandNotFound handler
- FlexPack is now properly integrated through buildtools CLI
- Added log.Debug message when JFROG_RUN_NATIVE is detected
- This provides better visibility into when FlexPack is being used
- Consistent with the logging in jfrog-cli-artifactory/artifactory/commands/mvn/utils.go
- Re-added the log.Debug message that was accidentally removed
- This debug message helps track when JFROG_RUN_NATIVE routing is used
- Removed duplicate import of jfrog-cli-core/v2/utils/log
- The file already uses jfrog-client-go/utils/log package
- This fixes the build error with redeclared log package
@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2025

👍 Frogbot scanned this pull request and did not find any new security issues.


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.

5 participants