简体   繁体   English

Intellij IDEA classpath.jar导致问题

[英]Intellij IDEA classpath.jar causing problems

When I run unit tests in Intellij IDEA, it is creating a jar called casspath0.jar. 当我在Intellij IDEA中运行单元测试时,它正在创建一个名为casspath0.jar的jar。 In that jar is a Manifest file with the classpath needed for the test to run. 在那个jar中是一个Manifest文件,其中包含运行测试所需的类路径。 How can I make intellij not do that? 我怎样才能使intellij不这样做呢?

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. 我正在运行Intellij IDEA 15.0.4,Java 1.8.0_77,Windows7。该项目是已导入到IDE中的gradle项目。

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. 其余的类路径位于该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. 我办公室的其他人都没有这个问题,这是一个非常古老的项目(超过10年),很多人(超过25岁)都在工作。 They all have the full classpath under that property rather than in a temporary jar. 它们都具有该属性下的完整类路径,而不是在临时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. 感谢您的任何想法。

I found the cause of this. 我找到了原因。 It has to do with the 'dynamic.classpath' setting in intellij IDEA. 它与intellij IDEA中的“ dynamic.classpath”设置有关。 What does the dynamic.classpath flag do? dynamic.classpath标志有什么作用? (IntelliJ project settings) (IntelliJ项目设置)

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. 至于我关于单元测试的问题,我想我将更改gradle在哪里下载依赖项以尝试使我的类路径更短。 How to change Gradle download location . 如何更改Gradle下载位置

Short of that I will have to dig into the library that is causing me problems and see if I can fix that. 否则,我将不得不深入研究导致我出现问题的库,看看是否可以解决该问题。

I have the same problem when starting up Glassfishv4, with a similar exception. 启动Glassfishv4时,我遇到同样的问题,但有类似的例外。 To fix it, find domain.xml and remove the following line: 要对其进行修复,请找到domain.xml并删除以下行:

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

After that, Glassfish starts without any errors. 之后,Glassfish将启动,而不会出现任何错误。

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. 在其他位置卸载并重新安装IntelliJ之后,服务器(Weblogic)启动时出现错误,我认为这与WL服务器无关。 It complained it could not find C:\\<path>\\gragent.jar. 它抱怨找不到C:\\ <路径> \\ gragent.jar。 One of my projects had .groovy files in it and also I was running a debug session at times too. 我的一个项目中包含.groovy文件,而且我有时也在运行调试会话。 Discovered that there was a hard-coded (ugh!) path reference to that .jar file in my workspace.xml file at C:\\<sourcepath>\\<project>\\.idea. 发现我的workspace.xml文件中位于.C:\\ <sourcepath> \\ <project> \\。idea的.jar文件有一个硬编码(ugh!)路径引用。 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. 在条目<configuration default =“ false” name =“ <name>”中,在value =“中的<option name =” COMMON_VM_ARGUMENTS“ ...>中键入=” WebLogic Instance“ factoryName =” Local“ ...>。 ..”,RHS值是通往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. 不需要重新启动IntelliJ,我能够保存文件并尝试通过使用IntelliJ再次运行服务器,并且出现了该错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM