简体   繁体   中英

Eclipse Maven Plugin not compiling against correct java version

I am quite new to using maven and I am using STS as a development environment. I have amended my pom file to indicate that my project should compile with java 7 yet regardless of what I do it always marks the manifest as using jdk 1.6.

<properties>
    <java-version>1.7</java-version>        
</properties>

<build>
    <plugins>
         <plugin>
           <artifactId>maven-compiler-plugin</artifactId>
             <version>3.0</version>         
             <configuration>
               <compilerVersion>1.7</compilerVersion>
               <source>1.7</source>
               <target>1.7</target>
             </configuration>
         </plugin>
     </plugins>
 </build>

What do I need to do to get it to pick up that my project is 1.7? Here is the text from the manifest for the project which always indicates 1.6:

Manifest-Version: 1.0
Built-By: pao
Build-Jdk: 1.6.0_25
Created-By: Maven Integration for Eclipse

The folder target\\m2e-wtp\\web-resources\\META-INF\\MANIFEST.MF is generated through the Maven integration you are using inside Eclipse and it is configured to be using JDK 1.6, either default or explicitly.

Change the configuration in your eclipse making sure your project is configured to use jdk 1.7.

I have the same problem

Manifest-Version: 1.0
Built-By: MrD
Build-Jdk: 1.8.0
Created-By: Maven Integration for Eclipse

vs ( package ):

Manifest-Version: 1.0
Built-By: MrD
Build-Jdk: 1.7.0_25
Created-By: Apache Maven 3.2.1
Archiver-Version: Plexus Archiver

I have no java 8 jdk in eclipse (namely in Preferences > Java > Installed JREs). I believe it's a bug - I reported here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=437668

Nevertheless I am not sure it actually builds with JDK 8 - maybe it just reports this wrongly ?

Had a similar issue with the version in the manifest file. It was remedied by changing the eclipse launch parameters to use the intended jvm. (which can also be done on the command line.) For me updating eclipse.ini to include:

-vm C:\\Java\\jdk1.7.0_60\\bin\\javaw.exe

(I chose the jdk version for other reasons too)

Then updated projects using maven plugin and all worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM