Hello, you can use "mvn -version" to see which java is used.
Gruss Bernd Am Wed, 31 Dec 2014 10:23:00 -0800 schrieb Mark Eggers <[email protected]>: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Ole, > > In one instance (have to check your mail again) there were no files to > compile, so nothing bad happened. > > If you run mvn clean test, then the target directory will be removed > and Maven will be forced to recompile everything. > > You should get the command line failure consistently then. > > - From your log that you posted: > > Warning: JAVA_HOME environment variable is not set. > > Also, can you run the following from the command line and see if it > works? > > javac -version > > You should get the version of javac echoed. If not, you have a path > problem. > > If you do, run the following command: > > which javac > > This should tell you where javac is installed. I don't know how > alternatives / OpenJDK gets installed on Ubuntu (I use Fedora and > Oracle's JDK), so I don't know if setting JAVA_HOME to javac's parent > directory is appropriate. > > For example, on my system 'which javac' results in: > > /usr/java/bin/javac > > This means that javac is in /usr/java/bin, and the parent directory > (/usr/java) is the value that JAVA_HOME is set to on my system. This > is actually a link to where the current version of Java is installed > on my system. > > One of these days I'll walk through alternatives and figure out if it > meets my needs (or if I should file bug reports). > > . . . just my two cents > /mde/ > > On 12/31/2014 9:52 AM, Ole Ersoy wrote: > > Hi Mark, > > > > I do have Open JDK installed. The reason this is strange is > > because the maven build runs fine from the command line after the > > project is run with Eclipse. Other maven builds I have also run > > fine from the command line. For example if I git clone apache > > commons math and run the build, it builds fine. > > > > In this case I'm just creating a very minimal project with: - > > pom.xml - src/test/java/hello/HelloTest.java > > > > When I try to run the build, it fails. If I import it into > > eclipse, it runs. When I try the build from the command line > > again, it runs. If I create another project with the same set of > > original resources, it fails all over again. > > > > Thoughts? > > > > Thanks again, Ole > > > > > > > > On 12/31/2014 11:17 AM, Mark Eggers wrote: On 12/31/2014 8:49 AM, > > Ole Ersoy wrote: > >>>> 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 > > Eclipse comes with its own compiler, so it only needs the JRE to > > run. > > > > The command line needs the JDK, which you don't have installed. > > > > Install the JDK, set $JAVA_HOME, and make sure $JAVA_HOME/bin is > > on your path. > > > > See the bottom of the following page for detailed instructions: > > > > http://maven.apache.org/download.cgi > > > > If you're uncomfortable about using a different Java version > > between command line and Eclipse, you can always point Eclipse to > > the JRE inside the JDK and use that as the default JRE for Eclipse > > and the IDE. > > > > . . . just my two cents /mde/ > > > >> > >> --- This email is free from viruses and malware because avast! > >> Antivirus protection is active. http://www.avast.com > >> > >> > >> --------------------------------------------------------------------- > >> > >> > To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2 > > iQEcBAEBAgAGBQJUpD8EAAoJEEFGbsYNeTwtV88H/0Eb/gERrruj44Ka5AGYqfFI > MFllzBPORmlWlD/ZpI9b4rEbpx8e3vyCURqPayWnquMTFfyg4HxXAf3mhyT3c5c0 > eY+ire0ClYZH514UvdgQHAMyuek/JXt5CuPFu9yEBJHVV5PTiJUMTRz0dzE4I4Ap > xj0/rO9zhriZnL1bFUC7zfTCSDhv6/qz2UmMTz6aod+w+J6OFa4KOTQ2Sg1FKUKx > CIaLqTVFMzkgorgFi3SpT0LM3nxrOT8ArzFbCJI/kWBknuN+qZGA8OvP/iK/t8jU > KrgU45GPe3lijQ8ZUmxWbHoAr7Wzp4tr8CJpNfSRYxLhXU/Im34IqoZ+WbSMrgk= > =7+DE > -----END PGP SIGNATURE----- > > --- > This email is free from viruses and malware because avast! Antivirus > protection is active. http://www.avast.com > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
