Description
If the environment variable "JAVA_HOME" is not set, an error is thrown during the Maven build of module 'distribution'.
ERROR: JAVA_HOME not found in your environment.
Please set the JAVA_HOME variable in your environment to match the location of your Java installation
This is thrown by the Maven job started by the maven-invoker-plugin.
Here from "modules/distribution/pom.xml":
<plugin> <artifactId>maven-invoker-plugin</artifactId> <version>2.0.0</version> <executions> <execution> <id>build-maven-samples</id> <phase>integration-test</phase> <goals> <goal>run</goal> </goals> <configuration> <projectsDirectory>${project.build.directory}/axis2-${project.version}/samples</projectsDirectory> <pomIncludes> <pomInclude>pom.xml</pomInclude> </pomIncludes> <streamLogs>true</streamLogs> </configuration> </execution> </executions> </plugin>
This problem can be resolved by adding the following line to the plugin configuration:
<javaHome>${java.home}</javaHome>
This passes the Java installation path of the current pom.xml to the invoked maven pom.xml.