2

When I run unit tests in Intellij IDEA, it is creating a jar called casspath0.jar. In that jar is a Manifest file with the classpath needed for the test to run. How can I make intellij not do that?

More Details:

I am running Intellij IDEA 15.0.4, Java 1.8.0_77, Windows 7. The project is a gradle project that was imported into the IDE.

When running a unit test in debug mode, if I run

System.getProperty("java.class.path")

I see something like

C:\Users\me\AppData\Local\Temp\classpath0.jar;C:\Users\me\.IntelliJIdea15\system\groovyHotSwap\gragent.jar

and that is it. The rest of the classpath is in that classpath0.jar.

No one else in my office has this problem and this is a very old project (10+ years) that a lot of people (25+) work on. They all have the full classpath under that property rather than in a temporary jar. I speculate that there must be some setting that I am missing. This is causing problems with me not being able to successfully run our unit tests.

Thanks for any ideas.

coldkreap
  • 61
  • 7

3 Answers3

4

I found the cause of this. It has to do with the 'dynamic.classpath' setting in intellij IDEA. What does the dynamic.classpath flag do? (IntelliJ project settings)

As for my problem about unit tests, I guess I am going to change where gradle downloads the dependencies to try and make my classpath shorter. How to change Gradle download location.

Short of that I will have to dig into the library that is causing me problems and see if I can fix that.

Community
  • 1
  • 1
coldkreap
  • 61
  • 7
2

I have the same problem when starting up Glassfishv4, with a similar exception. To fix it, find domain.xml and remove the following line:

<jvm-options>...system\groovyHotSwap\gragent.jar</jvm-options> 

After that, Glassfish starts without any errors.

Kurt Van den Branden
  • 11,995
  • 10
  • 76
  • 85
ciment
  • 21
  • 1
0

After uninstalling and reinstalling IntelliJ at a different location, I had an error on server (Weblogic) startup that I think had nothing to do with the fact that it was a WL server. It complained it could not find C:\<path>\gragent.jar. One of my projects had .groovy files in it and also I was running a debug session at times too. Discovered that there was a hard-coded (ugh!) path reference to that .jar file in my workspace.xml file at C:\<sourcepath>\<project>\.idea. In the entry <configuration default="false" name="<name>" type="WebLogic Instance" factoryName="Local"... > in <option name="COMMON_VM_ARGUMENTS"...> in the value="...", the RHS value was a hard path to gragent.jar. I had to update the path to the file's new location. Didn't need to re-start IntelliJ, I was able to save the file and try to run the server again from withing IntelliJ and it came up w/o that error.

Matt Campbell
  • 1,967
  • 1
  • 22
  • 34