Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-23594

Deprecated method call used in nexus-staging-ant-tasks causes failures with newer guava.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: New
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Staging
    • Labels:
    • Notability:
      3

      Description

      The nexus-staging-ant-tasks makes a deprecated call to com.google.common.base.Stopwatch().

      From the JavaDoc:

      /**
       * Creates (but does not start) a new stopwatch using {@link System#nanoTime}
       * as its time source.
       *
       * @deprecated Use {@link Stopwatch#createUnstarted()} instead. This
       *     constructor is scheduled to be removed in Guava release 17.0.
       */
      @Deprecated
      public Stopwatch() {
       this(Ticker.systemTicker());
      }
      

      So that should be changed to:

      Stopwatch watch =  Stopwatch.createUnstarted();
      

      Without this change, if a newer guava library is on the classpath you'll see this failure:

      java.lang.IllegalAccessError: Class com/sonatype/nexus/staging/client/internal/StagingWorkflowV3ServiceImpl illegally accessing "package private" member of class com/google/common/base/Stopwatch
      at com.sonatype.nexus.staging.client.internal.StagingWorkflowV3ServiceImpl.monitorRepositoryTransition(StagingWorkflowV3ServiceImpl.java:184)
      at com.sonatype.nexus.staging.client.internal.StagingWorkflowV2ServiceImpl$7.perform(StagingWorkflowV2ServiceImpl.java:205)
      at com.sonatype.nexus.staging.client.internal.StagingWorkflowV2ServiceImpl$7.perform(StagingWorkflowV2ServiceImpl.java:200)
      at com.sonatype.nexus.staging.client.internal.ExceptionConverter.runAndReturn(ExceptionConverter.java:38)
      at com.sonatype.nexus.staging.client.internal.StagingWorkflowV2ServiceImpl.finishStaging(StagingWorkflowV2ServiceImpl.java:199)
      at org.sonatype.nexus.ant.staging.deploy.AbstractDeployTask.afterUpload(AbstractDeployTask.java:283)
      at org.sonatype.nexus.ant.staging.deploy.AbstractDeployTask.stageRemotely(AbstractDeployTask.java:146)
      at org.sonatype.nexus.ant.staging.deploy.StageRemotelyTask.execute(StageRemotelyTask.java:31)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
      at java.lang.reflect.Method.invoke(Method.java:508)
      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
      at org.apache.tools.ant.Task.perform(Task.java:348)
      at org.apache.tools.ant.Target.execute(Target.java:435)
      at org.apache.tools.ant.Target.performTasks(Target.java:456)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
      at org.apache.tools.ant.Main.runBuild(Main.java:851)
      at org.apache.tools.ant.Main.startAnt(Main.java:235)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

      For those affected, a patched version of the jar that makes this change is attached.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            rseddon Rich Seddon
            Last Updated By:
            Wes Wannemacher
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Date of First Response:

                tigCommentSecurity.panel-title