maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Corin Lawson <corin.law...@gmail.com>
Subject No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
Date Mon, 13 May 2013 14:53:50 GMT
Hi,

This seems like a pretty simple one and I'm hoping that I'll feel quite dim
when I get answer...

My environment:

$ uname -srm
Darwin 12.3.0 x86_64
$ $JAVA_HOME/bin/javac -version
javac 1.7.0_21
javac: no source files
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is
doing
  -deprecation               Output source locations where deprecated APIs
are used
  -classpath <path>          Specify where to find user class files
  -cp <path>                 Specify where to find user class files
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -d <directory>             Specify where to place generated class files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified
release
  -target <release>          Generate class files for specific VM version
  -version                   Version information
  -help                      Print a synopsis of standard options
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home
$ mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 19:44:56+1100)
Maven home: /usr/share/maven
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home:
/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.3", arch: "x86_64", family: "mac"

(I note that 'Java home' is not set to my JAVA_HOME variable.)

In my pom.xml I have:

  <build>
    <plugins>
      <plugin>
        <inherited>true</inherited>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
          <encoding>UTF-8</encoding>
          <showWarnings>true</showWarnings>
          <showDeprecation>true</showDeprecation>
        </configuration>
      </plugin>
      ...

Running `mvn compile` I encounter this message:

[ERROR] No compiler is provided in this environment. Perhaps you are
running on a JRE rather than a JDK?

In disbelief I try:

$ MAVEN_OPTS=-Dmaven.compiler.forceJavacCompilerUse=true mvn compile

Only to encounter:

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] javac: invalid flag: -s

I tried adding tools.jar to maven's classpath (without using
forceJavacCompilerUse) but to no avail. It's almost as if
maven-compiler-plugin is expecting tools.jar to be under java.home, but
that is beyond belief... But maven-compiler-plugin doesn't seem to support
JDK 1.7 (no -s argument)?

Please point out the error of my ways :)

Cheers,
Corin.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message