Two messages at Maven compile time (workspace and default Classpath container)
Blog Category:
With Maven for more than a year, it is always a matter of two obscure compilation messages, and the two messages are as follows:
Java code
- [INFO] Using Eclipse Workspace:d:\maven\workspace
- [WARNING] Workspace defines a VM that does not contain a valid Jre/lib/rt.jar:c:\program files\java\jre7
- [INFO] Adding default Classpath container:org.eclipse.jdt.launching.jre_container/ org.eclipse.jdt.internal.debug.ui.launcher.standardvmtype/javase-1.6
Always do not understand why these two information, the morning finally understand, in fact, everything still from the compile time automatically converted the JRE said.
Each time the MAVEN project is compiled, its JRE System library in eclipse will always become JavaSE-1.6 instead of its own JRE, and then try to find the answer under Google with two URLs as follows
What do Maven use Eclipse workspace default JRE?
Http://stackoverflow.com/questions/12322202/how-to-make-maven-use-eclipse-workspace-default-jre
The famous StackOverflow, and one found on the MAVEN website, is linked as follows
The JDK is being used is different than expected
Http://maven.apache.org/plugins/maven-eclipse-plugin/trouble-shooting/jdk-being-used-is-different-than-expected.html
So slowly try to eliminate these two seemingly normal abnormal info/waring, two steps
1: In StackOverflow, the JRE pointed to eclipse may have a problem, and then checked, found that Jre_home point to the JRE directory, changed to the JDK directory
2: The MAVEN compilation plugin corresponds to the JDK version of the machine, such as I wrote in the project 1.6, and the machine is installed JDK1.7
Java code
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3. 2</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- <encoding>utf-8</encoding>
- </configuration>
- </plugin>
After Setup, the following information appears
Java code
- [INFO] Using Eclipse Workspace:d:\maven\workspace
- [INFO] Adding default Classpath container:org.eclipse.jdt.launching.JRE_CONTAINER
Workspace defines a VM that does not contain a valid Jre/lib/rt.jar:c:\program files\java\jre7