Maven
  1. Maven
  2. MNG-4747

Javaagent not usable since 3.0-alpha

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.0-alpha-6, 3.0-alpha-7, 3.0-beta-1
    • Fix Version/s: 3.0-beta-2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows XP 32bits SP3

      Description

      When launching a maven build, the -javaagent argument is ignored since Maven 3, and was processed with maven 2.X.X.

      The use case is a build with jetty:run goal (org.mortbay.jetty:jetty-maven-plugin 8.0.0.M1) with

      -javaagent:"${settings.localRepository}/org/springframework/spring-instrument/${spring-version}/spring-instrument-${spring-version}.jar"
      1. TestJavaAgent.zip
        7 kB
        Damien Feugas
      2. TestJavaAgent -v2.zip
        7 kB
        Damien Feugas

        Issue Links

          Activity

          Hide
          Benjamin Bentmann added a comment -

          We need more information than that, -javaagent is a JVM option, not a Maven option, and a quick test showed that setting it via MAVEN_OPTS is still effective, i.e. the JVM tries to load the agent. So please re-open with a minimal demo project that allows to reproduce your issue.

          Show
          Benjamin Bentmann added a comment - We need more information than that, -javaagent is a JVM option, not a Maven option, and a quick test showed that setting it via MAVEN_OPTS is still effective, i.e. the JVM tries to load the agent. So please re-open with a minimal demo project that allows to reproduce your issue.
          Hide
          Damien Feugas added a comment -

          All my apologies... I didn't take the time to make a proper bug report.
          So, here it is, a maven project that reproduce the problem.

          To reproduce the bug:
          1- set your PATH and M2_HOME to an Maven 3 installation.
          2- catch the artifact org.springframework:spring-instrument 3.0.2.RELEASE
          3- set MAVEN_OPTS to -javaagent:YOUR_REPO/org/springframework/spring-instrument/3.0.2.RELEASE/spring-instrument-3.0.2.RELEASE.jar
          4- run mvn jetty:run

          You'll get an exception :
          java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation

          Now :
          1- change your PATH and M2_HOME to a Maven 2 installation
          2- check that your repository was not any spaces in its path (cause the jetty plugin to fail)
          3- run mvn jetty:run

          Everything's fine, and if you go to http://localhost:8080/test/, you'll get
          Hello World ! - intercepted !

          Show
          Damien Feugas added a comment - All my apologies... I didn't take the time to make a proper bug report. So, here it is, a maven project that reproduce the problem. To reproduce the bug: 1- set your PATH and M2_HOME to an Maven 3 installation. 2- catch the artifact org.springframework:spring-instrument 3.0.2.RELEASE 3- set MAVEN_OPTS to -javaagent:YOUR_REPO/org/springframework/spring-instrument/3.0.2.RELEASE/spring-instrument-3.0.2.RELEASE.jar 4- run mvn jetty:run You'll get an exception : java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation Now : 1- change your PATH and M2_HOME to a Maven 2 installation 2- check that your repository was not any spaces in its path (cause the jetty plugin to fail) 3- run mvn jetty:run Everything's fine, and if you go to http://localhost:8080/test/ , you'll get Hello World ! - intercepted !
          Hide
          Damien Feugas added a comment -

          The test case

          Show
          Damien Feugas added a comment - The test case
          Hide
          Damien Feugas added a comment -

          Sorry, an configuration error in the pom (thank you Eclipse !)

          Show
          Damien Feugas added a comment - Sorry, an configuration error in the pom (thank you Eclipse !)
          Hide
          Benjamin Bentmann added a comment -

          Fixed in r982405.

          Show
          Benjamin Bentmann added a comment - Fixed in r982405 .

            People

            • Assignee:
              Benjamin Bentmann
              Reporter:
              Damien Feugas
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development