I'm upgrading a maven project to compile with Java 8 from Java 7.
The installed java versions on my machine are
pauloconnell@pauloconnell-HP-ZBook-15:~/$ update-java-alternatives -l
java-7-oracle 1076 /usr/lib/jvm/java-7-oracle
java-8-oracle 1077 /usr/lib/jvm/java-8-oracle
And my JAVA_HOME is set
pauloconnell@pauloconnell-HP-ZBook-15:~/$ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
Any these are the details in my .bashrc file
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export MAVEN_HOME=/usr/share/maven/bin
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin
When i run 'mvn compile' on a module with this plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>apt-maven-plugin</artifactId>
<configuration>
<factory>com.infonova.om.il.apt.Factory</factory>
<showWarnings>true</showWarnings>
</configuration>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
I get
[ERROR] Failed to execute goal org.codehaus.mojo:apt-maven-plugin:1.0-alpha-5:process (default) on project om-interface-eircom: Unable to locate the apt compiler in:
[ERROR] /usr/lib/jvm/java-8-oracle/jre/../lib/tools.jar
[ERROR] Please ensure you are using JDK 1.5 or above and
[ERROR] not a JRE (the com.sun.tools.apt.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
I found these existing issues
http://stackoverflow.com/questions/8375423/missing-artifact-com-suntoolsjar
https://github.com/thickpaddy/jenkins_campfire_plugin/issues/12
http://stackoverflow.com/questions/10812668/unable-to-locate-the-javac-compiler
http://stackoverflow.com/questions/5730815/unable-to-locate-tools-jar
and updated my plugin config to include the tools as systemPath dependency
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>apt-maven-plugin</artifactId>
<configuration>
<factory>com.infonova.om.il.apt.Factory</factory>
<showWarnings>true</showWarnings>
</configuration>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
but the problem presists. My maven version details are
pauloconnell@pauloconnell-HP-ZBook-15:~/$ mvn -version
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_IE, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-63-generic", arch: "amd64", family: "unix"
I believe i jave the correct JAVA_HOME and PATHS set. Any ideas?