Issue
I am trying to switch to a newer version of Netbeans, currently on 7.2.
The project maven pom.xml file contains an exec-maven-plugin (as below), when attempting to run the project via netbeans it executes the below instead of running the main class, this occurs on any class with any main method for that project
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>.\src\main\assembly\exe\edit_icons.bat</executable>
</configuration>
</plugin>
- Removing the above plugin will result in the RUN working correctly
- Compile on Save is off : no change
- Cache has been cleared : no change
- Project properties the Run tab has a main class and working directory defined
Additional Information
cd C:\Developer\workspaces\advancemobility\source\app-office; "JAVA_HOME=C:\Program Files\Java\jdk1.7.0_51" M2_HOME=C:\Developer\sdk\apache-maven-3.0 cmd /c "\"\"C:\Developer\sdk\apache-maven-3.0\bin\mvn.bat\" -Dexec.args=\"-classpath %classpath ${packageClassName}\" -Dexec.executable=\"C:\Program Files\Java\jdk1.7.0_51\bin\java.exe\" -DskipTests=true -Dmaven.ext.class.path=\"C:\Program Files\NetBeans 7.4\java\maven-nblib\netbeans-eventspy.jar\" --offline --debug -o -X process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""
Apache Maven 3.0 (r1004208; 2010-10-04 13:50:56+0200)
Java version: 1.7.0_51
Java home: C:\Program Files\Java\jdk1.7.0_51\jre
Default locale: en_ZA, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"
I've tried netbeans 7.4, 8.0, 8.01, 8.02 and all end with the same result, with a package being executed and the main class not being run
Anyone have any idea's? or something I may have overlooked?
Solution
Yeah, the Run command will pass the -D variable to set the executable (java.exe) but your configuration in pom wins.
Try moving your configuration->executable inside the execution element, that way your config is private to that execution and the cmd line should be able to inject a different value again.
Answered By - mkleint