Sn0wBlind
Sn0wBlind

Reputation: 123

IntelliJ + Maven Error: Could not find or load main class root

I am trying to use Maven (Bundled Maven 3) with an IntelliJ project (Spring). When I double click one of the Maven lifecycle steps I get the following error:

"C:\Program Files (x86)\Java\jdk1.8.0_25\bin\java" -Dmaven.multiModuleProjectDirectory=project root "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7536 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=14.1.4 clean

Error: Could not find or load main class root

Screenshot: enter image description here

I have searched both Google and StackOverflow for several hours but didn't find a solution for the problem.

I'm just starting to use Maven so I don't know a whole lot about it.

Thanks in advance.

Upvotes: 3

Views: 8666

Answers (2)

Damian
Damian

Reputation: 1

I had the same problem, and I try everything what I found. This solution weren't described anywhere: Go to: Run->Edit Configurations-> CHANGE "Use classpath of module" to different one. It resolved problem for me.

Upvotes: 0

Sn0wBlind
Sn0wBlind

Reputation: 123

The problem was a space in one of the IntelliJ Maven settings. In the Build Tools > Maven > Runner section I changed VM Options from

-Dmaven.multiModuleProjectDirectory=project root

to

-Dmaven.multiModuleProjectDirectory="project root"

Upvotes: 8

Related Questions