You can not add annotations ------ IDEA Maven project at issue in changing the default JDK version 1.5 to 1.8

Need to check the position

  • Maven configuration used is indeed their own default maven instead IDEA
    Maven
  • Java configuration used jdk has been configured properly, generally not a problem, but sometimes used 历史遗留when the project is low jdk version

1. Label a build a project configuration

This embodiment does not attempt, described by definition, global configuration, in Next, and Location tag to the same level of configuration

  • Global Configuration (project build)
    • Valid for all of the entire project
  • Configuration (profile build),
    • For different profile configuration
           <build> 
              <plugins> 
                <plugin> 
                  <groupId>org.apache.maven.plugins</groupId> 
                  <artifactId>maven-compiler-plugin</artifactId> 
                  <version>3.1</version> 
                  <configuration> 
                    <source>1.8</source> 
                    <target>1.8</target> 
                  </configuration> 
                </plugin> 
              </plugins> 
            </build>   

2. maven configuration, all using the maven are to take effect

conf in the Maven installation directory under / settings.xml Add the following tag

        <profile>  
            <id>jdk-1.8</id>  
            <activation>  
                <activeByDefault>true</activeByDefault>  
                <jdk>1.8</jdk>  
            </activation>  
            <properties>  
                <maven.compiler.source>1.8</maven.compiler.source>  
                <maven.compiler.target>1.8</maven.compiler.target>  
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>  
            </properties>
        </profile>

Guess you like

Origin www.cnblogs.com/akanga/p/11495375.html