jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
528 stars 223 forks source link

Unable to run `jf mvn` with `source:jar` or `javadoc:jar` with Maven 3.9.0 #1863

Closed harbulot closed 1 week ago

harbulot commented 1 year ago

Describe the bug

When using jf with Maven 3.9.0, using the source:jar javadoc:jar makes the build fail with an exception:

[main] ERROR org.apache.maven.cli.MavenCli - Cannot invoke "org.eclipse.aether.impl.RemoteRepositoryFilterManager.getRemoteRepositoryFilter(org.eclipse.aether.RepositorySystemSession)" because "this.remoteRepositoryFilterManager" is null

This is more or less the same problem as what's reported in JENKINS-70654 (which seems to be linked to the Jenkins Artifactory plugin), but this also happens when using jf directly on the command line.

Current behavior

The command is as follows (I've added -e to get the stack trace from Maven):

jf mvn -e clean source:jar javadoc:jar package
[Debug] JFrog CLI version: 2.34.6
[Debug] OS/Arch: linux/amd64
[Debug] Searching for Maven home.
[Debug] M2_HOME  is not defined. Retrieving Maven home using 'mvn --version' command.
[Debug] Usage Report: Sending info...
...
[Debug] Maven home location:  /opt/Maven_3.9.0
[Debug] Creating temp build file at: /tmp/jfrog/builds/9911f4d2b18457c4726664d309385072d295ca69062e99e66250033c13d09441
[🔵Info] Running Mvn...
[main] INFO org.apache.maven.cli.MavenCli - Error stacktraces are turned on.
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
[main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorder - Initializing Artifactory Build-Info Recording
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time:  0.560 s
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2023-03-11T12:03:59Z
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] ERROR org.apache.maven.cli.MavenCli - Cannot invoke "org.eclipse.aether.impl.RemoteRepositoryFilterManager.getRemoteRepositoryFilter(org.eclipse.aether.RepositorySystemSession)" because "this.remoteRepositoryFilterManager" is null
java.lang.NullPointerException: Cannot invoke "org.eclipse.aether.impl.RemoteRepositoryFilterManager.getRemoteRepositoryFilter(org.eclipse.aether.RepositorySystemSession)" because "this.remoteRepositoryFilterManager" is null
    at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolve (DefaultMetadataResolver.java:213)
    at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolveMetadata (DefaultMetadataResolver.java:198)
    at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseMetadataResolver.resolveMetadata (ArtifactoryEclipseMetadataResolver.java:51)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveMetadata (DefaultRepositorySystem.java:317)
    at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolveFromRepository (DefaultPluginPrefixResolver.java:162)
    at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve (DefaultPluginPrefixResolver.java:83)
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix (MojoDescriptorCreator.java:247)
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor (MojoDescriptorCreator.java:209)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments (DefaultLifecycleTaskSegmentCalculator.java:94)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments (DefaultLifecycleTaskSegmentCalculator.java:76)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:84)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.

Reproduction steps

Expected behavior

This works fine:

JFrog CLI version

2.34.6

Operating system type and version

Linux

JFrog Artifactory version

No response

JFrog Xray version

No response

deltamualpha commented 1 year ago

We're also seeing this issue when running the command jfrog rt mvn clean install after installing jfrog via curl -fLs https://getcli.jfrog.io/ | sh. Our underlying JVM and maven versions are based on maven:3.9.0-eclipse-temurin-17-focal.

suyashsingh-dlg commented 1 year ago

We also see the same issue with running the command using the jf mvn clean install. Is there any workaround suggested if we have to have maven 3.9 version in place?

talarian1 commented 1 year ago

Hi @harbulot, @deltamualpha @suyashsingh-dlg Thanks for reporting this issue. JFrog Cli 2.35.0 has been released and includes a fix for this issue. Any feedback will be appreciated.

deltamualpha commented 1 year ago

Will there be a fix for the v1 branch as well?

eyalbe4 commented 1 year ago

@deltamualpha - A fix for v1 branch isn't planned for now. We strongly recommend using the latest version of JFrog CLI.

deltamualpha commented 1 year ago

A little off-topic for this issue, then, but we didn't even realize there was a major version update available, since getcli.jfrog.io appears to still be installing v1 with no hints that there's even a v2 available. A notice on stderr would be helpful.

krishnamanchikalapudi commented 1 week ago

The command jf mvn -e clean source:jar javadoc:jar package worked for me on the Spring Petclinic maven project https://github.com/spring-projects/spring-petclinic using using JFrog CLI version 2.66.0

deltamualpha commented 1 week ago

This issue can probably be closed.