-Dmaven.multiModuleProjectDirectory system property is not set in JDeveloper 12.1.3 and external maven
<p>In JDeveloper 12.1.3 get 'suddenly' follwing error when running any maven goal on a random Java application. I mean suddenly, because i use JDeveloper infrequently for making modifications to Java classes and do not have full control over my Development environment. (Managed by admins).</p>

<p>Most important env variables are;</p>

<pre><code>M2 = %M2_HOME%\bin
M2_HOME = D:\Tools\apache-maven-3.3.9
MAVEN_HOME = D:\Tools\apache-maven-3.3.9
MAVEN_OPTS = -Xms256m -Xmx512m -Dmaven.multiModuleProjectDirectory=%MAVEN_HOME%
</code></pre>

<p>I also tried enclose %MAVEN_HOME% in double quotes.</p>

<p>Maven preferences in JDeveloper are</p>

<pre><code>Maven Version, external version: D:\Tools\apache-maven-3.3.9
User settings: D:\Tools\apache-maven-3.3.9\conf\settings.xml
Additional settings: -X -DdownloadSources=true -DdownloadJavadocs=true  -P deploy-to-local-server -Dmaven.multiModuleProjectDirectory=D:\Tools\apache-maven-3.3.9
Local Repository: D:\Tools\Apache\maven3_repository
Index Directory: D:\Tools\Apache\maven3_index
</code></pre>

<p>All settings seems to be ok. When running mvn from the commandline, e.g. <code>mvn test --settings D:\Tools\apache-maven-3.3.3\conf\settings.xml</code> the build completes successfully.</p>

<p>Als tried to set the Java property in the jdev.conf <code>AddVMOption -Dmaven.multiModuleProjectDirectory="%MAVEN_HOME%"</code></p>

<p>If the mvn goal test is chosen in JDeveloper it executes the command;</p>

<pre><code>D:\Oracle\Java\jdk1.7.0_45\bin\javaw.exe -classpath D:\Tools\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;D:\Tools\apache-maven-3.3.9\lib\wagon-provider-api-2.10.jar;D:\Tools\apache-maven-3.3.9\lib\wagon-http-shared-2.10.jar;D:\Tools\apache-maven-3.3.9\lib\wagon-http-2.10-shaded.jar;D:\Tools\apache-maven-3.3.9\lib\wagon-file-2.10.jar;D:\Tools\apache-maven-3.3.9\lib\slf4j-simple-1.7.5.jar;D:\Tools\apache-maven-3.3.9\lib\slf4j-api-1.7.5.jar;D:\Tools\apache-maven-3.3.9\lib\plexus-utils-3.0.22.jar;D:\Tools\apache-maven-3.3.9\lib\plexus-sec-dispatcher-1.3.jar;D:\Tools\apache-maven-3.3.9\lib\plexus-interpolation-1.21.jar;D:\Tools\apache-maven-3.3.9\lib\plexus-component-annotations-1.6.jar;D:\Tools\apache-maven-3.3.9\lib\plexus-cipher-1.7.jar;D:\Tools\apache-maven-3.3.9\lib\org.eclipse.sisu.plexus-0.3.2.jar;D:\Tools\apache-maven-3.3.9\lib\org.eclipse.sisu.inject-0.3.2.jar;D:\Tools\apache-maven-3.3.9\lib\maven-settings-builder-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-settings-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-repository-metadata-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-plugin-api-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-model-builder-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-model-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-embedder-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-core-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-compat-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-builder-support-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-artifact-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\maven-aether-provider-3.3.9.jar;D:\Tools\apache-maven-3.3.9\lib\jsr250-api-1.0.jar;D:\Tools\apache-maven-3.3.9\lib\jsoup-1.7.2.jar;D:\Tools\apache-maven-3.3.9\lib\javax.inject-1.jar;D:\Tools\apache-maven-3.3.9\lib\guice-4.0-no_aop.jar;D:\Tools\apache-maven-3.3.9\lib\guava-18.0.jar;D:\Tools\apache-maven-3.3.9\lib\commons-lang3-3.4.jar;D:\Tools\apache-maven-3.3.9\lib\commons-lang-2.6.jar;D:\Tools\apache-maven-3.3.9\lib\commons-io-2.2.jar;D:\Tools\apache-maven-3.3.9\lib\commons-cli-1.2.jar;D:\Tools\apache-maven-3.3.9\lib\cdi-api-1.0.jar;D:\Tools\apache-maven-3.3.9\lib\aopalliance-1.0.jar;D:\Tools\apache-maven-3.3.9\lib\aether-util-1.0.2.v20150114.jar;D:\Tools\apache-maven-3.3.9\lib\aether-transport-wagon-1.0.2.v20150114.jar;D:\Tools\apache-maven-3.3.9\lib\aether-spi-1.0.2.v20150114.jar;D:\Tools\apache-maven-3.3.9\lib\aether-impl-1.0.2.v20150114.jar;D:\Tools\apache-maven-3.3.9\lib\aether-connector-basic-1.0.2.v20150114.jar;D:\Tools\apache-maven-3.3.9\lib\aether-api-1.0.2.v20150114.jar; -Dclassworlds.conf=D:\Tools\apache-maven-3.3.9\bin\m2.conf -Dmaven.home=D:\Tools\apache-maven-3.3.9 org.codehaus.classworlds.Launcher -X -DdownloadSources=true -DdownloadJavadocs=true -P deploy-to-local-server -Dmaven.multiModuleProjectDirectory=D:\Tools\apache-maven-3.3.9 --settings D:\Tools\apache-maven-3.3.9\conf\settings.xml --file C:\Projecten\project\A\B\pom.xml clean -Denv.ORACLE_HOME=D:\Oracle\Middleware_JDev12.1.3
</code></pre>

<p>When executing this command on the commandline it completes, but does not seem to execute to goal. If javaw is replace with java it shows the error <code>-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.</code> again. As can be seen in de command extract above, the system property is set.</p>

<p>Any other suggestions ? </p>