Hi, I'm seeing some strange behavior with Maven 3.0.5 on Ubuntu.
BACKGROUND ===================== When I run `mvn test` the console prints: `[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?` If I then open the project in Eclipse and run the test it runs fine. Subsequently if I close Eclipse and run the test with `mvn test` I get `BUILD SUCCESS`. ANALYSIS ===================== I run `mvn test` on the `test2` project, that was opened with eclipse, and I get -> `BUILD SUCCESS`. I then create a `test3` project, copy the pom and the src directory from test2 to test 3. When running `mvn test` on the `test3` project I get the error again. I included the result from my console below: ole@MKI:~/test2$ mvn test Warning: JAVA_HOME environment variable is not set. [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building test-maven 1.0.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ test-maven --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/ole/test2/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ test-maven --- [INFO] No sources to compile [INFO] [INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ test-maven --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/ole/test2/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ test-maven --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ test-maven --- [INFO] Surefire report directory: /home/ole/test2/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running hello.HelloUnitTest Greeting from hello the Unit Test! Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.039 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.027s [INFO] Finished at: Wed Dec 31 10:41:25 CST 2014 [INFO] Final Memory: 8M/240M [INFO] ------------------------------------------------------------------------ ole@MKI:~/test2$ mkdir ../test3 ole@MKI:~/test2$ cp pom.xml ../test3 ole@MKI:~/test2$ cp -r src ../test3 ole@MKI:~/test2$ cd ../test3/ ole@MKI:~/test3$ mvn test Warning: JAVA_HOME environment variable is not set. [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building test-maven 1.0.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ test-maven --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/ole/test3/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ test-maven --- [INFO] No sources to compile [INFO] [INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ test-maven --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/ole/test3/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ test-maven --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /home/ole/test3/target/test-classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.722s [INFO] Finished at: Wed Dec 31 10:42:07 CST 2014 [INFO] Final Memory: 8M/303M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:testCompile (default-testCompile) on project test-maven: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException ole@MKI:~/test3$ tree . ├── pom.xml ├── src │ └── test │ └── java │ └── hello │ └── HelloUnitTest.java └── target ├── generated-test-sources │ └── test-annotations ├── maven-status │ └── maven-compiler-plugin │ └── testCompile │ └── default-testCompile │ ├── createdFiles.lst │ └── inputFiles.lst └── test-classes 12 directories, 4 files Thoughts (Besides just open it in Eclipse :) )? TIA, - Ole --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org