I have the latest version of intellij 2018.1.1 and I am running a very basic maven project. I get an error message as "Command line is too long" when I try to run main. I updated the run config to JAR Manifest and now intellij doesnt pick up the latest changes in my java files. I am assuming it picks up a pre-made jar and doesnt re-compile? I am trying to figure out how to get intellij to work.
-
There are multiple options to shorten the command line, try some other one. In case the issue persists, share the Minimal, Complete, and Verifiable example.– CrazyCoderApr 12, 2018 at 11:29
-
Will do, thank you. Why does intellij not pick up the changes in the code though?– zooesApr 12, 2018 at 11:31
-
1I have no command like args, so why does intellij think that its too long?– zooesApr 12, 2018 at 11:51
-
1How do I check what command intellij is trying to use?– zooesApr 12, 2018 at 11:52
-
1I have this issue only after upgrading.– zooesApr 12, 2018 at 12:02
7 Answers
To fix this, Edit the configuration the Run/Debug job in Intellij and select an appropriate "Shorten Command line" value that makes sense for your environment. Then try running the test again. If you are not sure about the correct value, simply try each of them till you get it to work. Here's a screenshot and the value that worked for me on Windows.
change project/.idea/workspace.xml
from
<component name="PropertiesComponent">
...
</component>
to
<component name="PropertiesComponent">
<property name="dynamic.classpath" value="true" />
...
</component>
In the newer versions of Intellij they've hidden the menu for shortening the command line by clicking "More Options" then select the Short Command Line.
Inside your .idea folder, change workspace.xml file
Add
<property name="dynamic.classpath" value="true" />
to
<component name="PropertiesComponent">
.
.
.
</component>
Example
<component name="PropertiesComponent">
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
<property name="dynamic.classpath" value="true" />
</component>
Try to delete .idea folder and import the project again. Run 'mvn clean compile' and then run the main method.
I needed to add before launch settings to make it work with JAR Manifest option to shorten command line. This did the trick for me. Thanks for the quick responses!
I had the same issue and resolved it in :
- closing IntelliJ
- removing the
.idea
directory - Reopening the project