Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy did maven suddenly start compiling with an older version of Java?
    text
    copied!<p>I've been developing in Java using maven for a few days now. Today I edited my pom.xml based on <a href="http://maven.apache.org/shared/maven-archiver/examples/classpath.html" rel="nofollow">these instructions</a>. Suddenly running <code>mvn compile</code> is giving me errors as if I was compiling with an older version of java. Stuff like:</p> <blockquote> <p>error: generics are not supported in -source 1.3</p> </blockquote> <p>Now I've paired my pom.xml back to its original content, and I'm <em>still</em> getting this error. I've done a <code>mvn clean</code> and deleted everything under target, and am still having this problem. </p> <p>Here's a snippet of maven running the compilation phase:</p> <pre> [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building bahToBeh 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ bahToBeh --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/doug/lucid/bah-bio-demo/bahToBeh/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ bahToBeh --- [INFO] Compiling 9 source files to /home/doug/lucid/bah-bio-demo/bahToBeh/target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.880s [INFO] Finished at: Thu Dec 20 13:52:06 EST 2012 [INFO] Final Memory: 7M/105M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project bahToBeh: Compilation failure: Compilation failure: [ERROR] /home/doug/lucid/bah-bio-demo/bahToBeh/src/main/java/com/lucid/bahdemo/parsers/pm/MeshReader.java:[23,4] error: generics are not supported in -source 1.3 </pre> <p>And my paired-down pom.xml:</p> <pre><code>&lt;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"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.lucid&lt;/groupId&gt; &lt;artifactId&gt;bahToBeh&lt;/artifactId&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;name&gt;bahToBeh&lt;/name&gt; &lt;url&gt;http://maven.apache.org&lt;/url&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;4.8.1&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;com.digitalpebble&lt;/groupId&gt; &lt;artifactId&gt;behemoth-core&lt;/artifactId&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.hadoop&lt;/groupId&gt; &lt;artifactId&gt;hadoop-core&lt;/artifactId&gt; &lt;version&gt;1.0.4&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;marc4j&lt;/groupId&gt; &lt;artifactId&gt;marc4j&lt;/artifactId&gt; &lt;version&gt;2.4&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <p>This had been working fine up until today. I'm not sure what setting I might have changed or how I could have munged up my project. I even double checked that the correct versions of java are installed:</p> <pre> doug@doug-VirtualBox:~/lucid/bah-bio-demo/bahToBeh$ java -version java version "1.7.0_10" Java(TM) SE Runtime Environment (build 1.7.0_10-b18) Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode) doug@doug-VirtualBox:~/lucid/bah-bio-demo/bahToBeh$ javac -version javac 1.7.0_10 </pre> <p>Here is JAVA_HOME</p> <pre> doug@doug-VirtualBox:~/lucid/bah-bio-demo/bahToBeh$ echo $JAVA_HOME /usr/lib/jvm/java-7-oracle </pre> <p>Maven <em>IS</em> using the pom.xml I think it is, if I run <code>mvn -X compile</code> I get:</p> <blockquote> <p>DEBUG] (f) project = MavenProject: com.lucid:bahToBeh:1.0-SNAPSHOT @ /home/doug/lucid/bah-bio-demo/bahToBeh/pom.xml</p> </blockquote> <p>I've also deleted my maven repo <code>rm -rf ~/.m2</code> and saw maven redownload everything same problem. </p> <p><strong>EDIT -- It suddenly works mysteriously</strong> I have no idea what happened, but suddenly now its working. I thought that one thing I changed was I commented out a test. I went and uncommented out the test and then ran <code>mvn compile</code> and this time it compiled. Some state somewhere was out-of-sync and now things magically work?</p> <p>I hate not knowing why my tools suddenly go wonky, so this is not an answer to the question, merely more information.</p> <p><strong>EDIT -- and it also just suddenly STOPPED working again</strong> Looks like fully specifying the version to compile works though, so dingding thats the winner.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload