2

I'm following the instructions on running the Spring Petclinic: https://github.com/spring-projects/spring-petclinic

git clone https://github.com/spring-projects/spring-petclinic.git
cd spring-petclinic
./mvnw spring-boot:run

I added the -javaagent:xrebel.jar to the mvnw script:

exec "$JAVACMD" \
   $MAVEN_OPTS \
   -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" "-javaagent:xrebel.jar" \
   "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
   ${WRAPPER_LAUNCHER} $MAVEN_CMD_LINE_ARGS \

But the XRebel toolbar doesn't get injected into the webapp. The XRebel banner shows up in the console verifying that the xrebel.jar is getting picked up and licensed properly, and XRebel is creating logs.

I also tried exporting MAVEN_OPTS outside of the script:

   export $MAVEN_OPTS="-javaagent:xrebel.jar"

but the same thing happens.

CYang
  • 23
  • 2

1 Answers1

3

It looks like the -javaagent that you added to the script and/or to MAVEN_OPTS is not getting propagated to the correct JVM. It only affects the mvn that you run.

One way to get this to work is to use a run.jvmArguments option documented at the Spring Boot Maven Plugin. So the final command would be for you:

./mvnw spring-boot:run -Drun.jvmArguments="-javaagent:xrebel.jar"

The upside of this approach is also that you don't need to edit any scripts.

toomasr
  • 4,731
  • 2
  • 33
  • 36