cescoffier / maven-play2-plugin

A Maven Plugin to build Play2 applications
Apache License 2.0
49 stars 41 forks source link

Compile goal does not inherit $JAVA_HOME thus cannot find javac #27

Closed zensurreal closed 12 years ago

zensurreal commented 12 years ago

ISSUE

I've encountered an issue where the compile goal is failing with not being able to find javac. If I compile using play compile it succeeds. Here's the exception when using the Maven plugin to compile:

[INFO] Looking for 'play' in the System PATH [info] Loading project definition from /var/atlassian/data/bamboo/xml-data/build-dir/KIPA-TBT/mms/liveAdmin/project [info] Set current project to liveAdmin (in build file:/var/atlassian/data/bamboo/xml-data/build-dir/KIPA-TBT/mms/liveAdmin/) [info] Updating {file:/var/atlassian/data/bamboo/xml-data/build-dir/KIPA-TBT/mms/liveAdmin/}liveAdmin... [info] Done updating.
[info] Compiling 5 Scala sources and 16 Java sources to /var/atlassian/data/bamboo/xml-data/build-dir/KIPA-TBT/mms/liveAdmin/target/scala-2.9.1/classes... [error] {file:/var/atlassian/data/bamboo/xml-data/build-dir/KIPA-TBT/mms/liveAdmin/}liveAdmin/compile:compile: java.io.IOException: Cannot run program "javac": java.io.IOException: error=2, No such file or directory [error] Total time: 12 s, completed Sep 4, 2012 8:33:48 PM [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error during compilation

It feels like an environment issue where the compile goal is not inheriting $JAVA_HOME when using the plugin.


WORKAROUND:

I was able to determine the cause of the issue. For some reason when the compile goal invokes play to compile, commons exec does not inherit the environment setting for $JAVA_HOME. This is on CentOS Linux. This works fine on MacOS though.

The workaround was to modify the play script to set $JAVA_HOME and add $JAVA_HOME/bin to the $PATH.

cescoffier commented 12 years ago

Hi,

I've tried to propagate the environment to the launched process. So it inherits the PATH and JAVA_HOME properties. Can somebody test on Windows ?

Thanks.