Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion buildtools/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import (
huggingfaceuploaddocs "github.com/jfrog/jfrog-cli/docs/buildtools/huggingfaceupload"
mvndoc "github.com/jfrog/jfrog-cli/docs/buildtools/mvn"
"github.com/jfrog/jfrog-cli/docs/buildtools/mvnconfig"
mvnwdoc "github.com/jfrog/jfrog-cli/docs/buildtools/mvnw"
"github.com/jfrog/jfrog-cli/docs/buildtools/nix"
"github.com/jfrog/jfrog-cli/docs/buildtools/npmcommand"
"github.com/jfrog/jfrog-cli/docs/buildtools/npmconfig"
Expand Down Expand Up @@ -143,6 +144,21 @@ func GetCommands() []cli.Command {
return securityCLI.WrapCmdWithCurationPostFailureRun(c, MvnCmd, techutils.Maven, cmdName)
},
},
{
Name: "mvnw",
Flags: cliutils.GetCommandFlags(cliutils.Mvn),
Usage: corecommon.ResolveDescription(mvnwdoc.GetDescription(), mvnwdoc.GetAIDescription()),
HelpName: corecommon.CreateUsage("mvnw", corecommon.ResolveDescription(mvnwdoc.GetDescription(), mvnwdoc.GetAIDescription()), mvnwdoc.Usage),
UsageText: mvnwdoc.GetArguments(),
ArgsUsage: common.CreateEnvVars(mvnwdoc.EnvVar...),
SkipFlagParsing: true,
BashComplete: corecommon.CreateBashCompletionFunc(),
Category: buildToolsCategory,
Action: func(c *cli.Context) (err error) {
cmdName, _ := getCommandName(c.Args())
return securityCLI.WrapCmdWithCurationPostFailureRun(c, MvnwCmd, techutils.Maven, cmdName)
},
},
{
Name: "gradle-config",
Aliases: []string{"gradlec"},
Expand Down Expand Up @@ -664,7 +680,19 @@ func captureUserFlagsForMetrics(c *cli.Context, skipFlagParsing bool) {
commands.SetContextFlags(flags)
}

// MvnCmd runs "jf mvn". In native (FlexPack) mode it always runs "mvn" from PATH.
func MvnCmd(c *cli.Context) (err error) {
return runMvn(c, false)
}

// MvnwCmd runs "jf mvnw". In native (FlexPack) mode it requires a Maven Wrapper
// (mvnw/mvnw.cmd) to be present and fails otherwise; in legacy (config-file) mode
// it behaves exactly like MvnCmd.
func MvnwCmd(c *cli.Context) (err error) {
return runMvn(c, true)
}

Comment thread
fluxxBot marked this conversation as resolved.
func runMvn(c *cli.Context, preferWrapper bool) (err error) {
if show, err := cliutils.ShowCmdHelpIfNeeded(c, c.Args()); show || err != nil {
return err
}
Expand All @@ -688,10 +716,14 @@ func MvnCmd(c *cli.Context) (err error) {
if err != nil {
return err
}
mvnCmd := mvn.NewMvnCommand().SetConfigPath("").SetGoals(filteredMavenArgs).SetConfiguration(buildConfiguration).SetServerDetails(serverDetails)
mvnCmd := mvn.NewMvnCommand().SetConfigPath("").SetGoals(filteredMavenArgs).SetConfiguration(buildConfiguration).SetServerDetails(serverDetails).SetPreferWrapper(preferWrapper)
Comment thread
fluxxBot marked this conversation as resolved.
return commands.ExecWithPackageManager(mvnCmd, project.Maven.String())
}

if preferWrapper {
log.Warn("jf mvnw's wrapper requirement is not respected in legacy (config-file) mode; falling back to the standard jf mvn behavior, governed by the 'useWrapper' setting in the Maven config.")
}

// If config file is missing and not in native mode, return the standard missing-config error.
if !configExists {
if configFilePath, err = getProjectConfigPathOrThrow(project.Maven, "mvn", "mvn-config"); err != nil {
Expand Down
37 changes: 37 additions & 0 deletions docs/buildtools/mvnw/help.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package mvnw

import "github.com/jfrog/jfrog-cli/docs/common"

var Usage = []string{"mvnw <goals and options> [command options]"}

var EnvVar = []string{common.JfrogCliReleasesRepo, common.JfrogCliDependenciesDir}

func GetDescription() string {
return "Run a Maven build using the project's Maven Wrapper (mvnw/mvnw.cmd)."
}

func GetArguments() string {
return ` goals and options
Goals and options to run with the mvnw command. For example -f path/to/pom.xml`
}

func GetAIDescription() string {
return `Run a Maven build through the project's Maven Wrapper (mvnw on Mac/Linux, mvnw.cmd on Windows) with JFrog instrumentation: resolves dependencies and deploys artifacts through Artifactory, optionally collecting build-info for traceability. Behaves like 'jf mvn' but requires a Maven Wrapper; it does not fall back to a system-installed mvn.

When to use:
- The project pins its Maven version via a checked-in Maven Wrapper and CI/local builds must use that exact version instead of whatever 'mvn' resolves to on PATH.

Prerequisites:
- A Maven Wrapper (mvnw/mvnw.cmd plus .mvn/wrapper/maven-wrapper.properties) checked into the project, in the current directory or a parent directory.
- Only meaningful in native (FlexPack) mode; if a Maven config file exists for the project, this command behaves exactly like 'jf mvn'.

Common patterns:
$ jf mvnw clean install
$ jf mvnw package -DskipTests

Gotchas:
- If no Maven Wrapper is found upward from the working directory, the command fails rather than silently falling back to a system mvn.
- Unlike 'jf mvn', this command never runs a system-installed mvn when a wrapper is present or required.

Related: jf mvn, jf mvn-config`
}
27 changes: 15 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ replace (
require (
github.com/BurntSushi/toml v1.6.0
github.com/agnivade/levenshtein v1.2.1
github.com/buger/jsonparser v1.2.0
github.com/buger/jsonparser v1.3.0
github.com/gocarina/gocsv v0.0.0-20260607070740-0735908c6461
github.com/jfrog/archiver/v3 v3.6.3
github.com/jfrog/build-info-go v1.13.1-0.20260713073853-4f3044bf0940
github.com/jfrog/gofrog v1.7.6
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260713081138-6df6041db819
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260722060859-50ee96befe5c
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260724083402-361ba4a2ecdb
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260728121041-2227ac7420a0
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260728105909-591d4872e483
github.com/jfrog/jfrog-cli-evidence v0.9.5-0.20260618135203-4d2bdd4ee35f
github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260618062042-6053ab368cab
github.com/jfrog/jfrog-cli-security v1.31.3
Expand Down Expand Up @@ -50,7 +50,7 @@ require (
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
github.com/andybalholm/brotli v1.2.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beevik/etree v1.6.0 // indirect
github.com/beevik/etree v1.7.0 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/c-bata/go-prompt v0.2.6 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
Expand Down Expand Up @@ -134,7 +134,7 @@ require (
github.com/in-toto/attestation v1.2.0 // indirect
github.com/in-toto/in-toto-golang v0.11.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jedib0t/go-pretty/v6 v6.8.0 // indirect
github.com/jedib0t/go-pretty/v6 v6.8.3 // indirect
github.com/jfrog/froggit-go v1.23.0 // indirect
github.com/jfrog/go-mockhttp v0.3.1 // indirect
github.com/jfrog/jfrog-apps-config v1.0.1 // indirect
Expand All @@ -144,11 +144,11 @@ require (
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/ktrysmt/go-bitbucket v0.10.0 // indirect
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/magiconair/properties v1.18.11 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.15 // indirect
github.com/mattn/go-isatty v0.0.22 // indirect
github.com/mattn/go-runewidth v0.0.24 // indirect
github.com/mattn/go-runewidth v0.0.27 // indirect
github.com/mattn/go-tty v0.0.8 // indirect
github.com/microsoft/azure-devops-go-api/azuredevops/v7 v7.1.0 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
Expand Down Expand Up @@ -203,7 +203,8 @@ require (
github.com/transparency-dev/formats v0.1.1 // indirect
github.com/transparency-dev/merkle v0.0.2 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/vbauerster/mpb/v8 v8.12.1 // indirect
github.com/vbauerster/cupwriter v0.0.4 // indirect
github.com/vbauerster/mpb/v8 v8.14.0 // indirect
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect
github.com/xanzy/go-gitlab v0.115.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
Expand All @@ -221,13 +222,13 @@ require (
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.53.0 // indirect
golang.org/x/mod v0.36.0 // indirect
golang.org/x/mod v0.37.0 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.22.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/term v0.44.0 // indirect
golang.org/x/text v0.38.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/term v0.45.0 // indirect
golang.org/x/text v0.40.0 // indirect
golang.org/x/time v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
Expand All @@ -249,3 +250,5 @@ require (
// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260604085947-7c110b77b4b4

//replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.54.2-0.20251007084958-5eeaa42c31a6

// replace github.com/jfrog/jfrog-cli-artifactory => github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260723100012-d9e9c3412cb2
Loading
Loading