In IntelliJ idea 14.1, JDK is not configured in java Maven. idea14.1maven

Source: Internet
Author: User

In IntelliJ idea 14.1, JDK is not configured in java Maven. idea14.1maven

When using Maven in IntelliJ IDEA 14.1 in java projects, IDEA sets the default build version and source code version to jdk5.

In IDEA, the Language level uses the default JDK 5 level.

The target version is JDK5 by default.

 

When you manually change to another version, such as JDK 8, but when you re-load the Maven project, IDEA sets the default Language level and Target bycode version to JDK 5.

In the project, you will see the following problems:

The source value 1.5 is out of date and will be deleted in all future versions.

The target value 1.5 is out of date and will be deleted in all future versions.

This is because IDEA sets the source code version of the project to jdk1.5 by default and the target code to jdk1.5.

 

 

Solution: 

Add the following in the pom. xml file of the project:

1 <properties>2         <maven.compiler.source>1.8</maven.compiler.source>3         <maven.compiler.target>1.8</maven.compiler.target>4 </properties>

Or modify the Settings. xml file of Maven to add the following content:

 1 <profile> 2            <id>jdk-1.8</id> 3            <activation> 4               <activeByDefault>true</activeByDefault> 5               <jdk>1.8</jdk> 6             </activation> 7                     <properties> 8                        <maven.compiler.source>1.8</maven.compiler.source> 9                             <maven.compiler.target>1.8</maven.compiler.target>10                              <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 11                     </properties>12 </profile>

After modification, IDEA will use the jdk version configured in Maven in the source and target jdk versions.

First Article address: Solinx

Http://www.solinx.co/archives/157

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.