Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
When trying to run
mvn clean package
I get the following error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-
plugin:3.6.0:compile (default-compile) on project rest-webapp:
Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:
3.6.0:compile failed: A required class was missing while executing
org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile:
org/codehaus/plexus/compiler/manager/NoSuchCompilerException
I found numerous suggestions to delete everything in ~/.m2/repository
. Doing so does not fix the issue.
Here is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rest</groupId>
<artifactId>rest-webapp</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>rest-webapp</name>
<build>
<finalName>rest-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<inherited>true</inherited>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.0_ALPHA</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-manager</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<properties>
<jersey.version>2.25</jersey.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
I am using Mac OSX 10.11.6
$JAVA_HOME is /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
$PATH is /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin:/opt/apache-maven-3.3.9/bin
Any suggestions would be greatly appreciated.
Edit: The stack trace when I run mvn clean package -X
is posted here:
http://pastebin.ca/3753171
–
–
The correct way to set up command line java in OS X is to use:
export JAVA_HOME=`/usr/libexec/java_home -v1.8`
This not only sets the JAVA_HOME
environment variable, but also adjusts a bunch of links in /usr/bin
so that:
[steve@Steves-MacBook-Pro ~]$ which java
/usr/bin/java
[steve@Steves-MacBook-Pro ~]$ which javac
/usr/bin/javac
applies to the version that you specify in the /usr/libexec/java_home
call, therefore there is no need to add $JAVA_HOME/bin
to your $PATH
.
I'm guessing that you have never done this, so you're getting the Java tooling from /usr/bin
which is trumping your $PATH environment because it appears before /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin
.
–
–
–
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.