Maven Update后编译器版本被还原

2019-04-26  本文已影响0人  丶晓虎

若要指定编译器版本,有两种方式,第一种在Setting.xml配置,第二种在pom.xml中配置
一、在setting.xml中配置:

<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> 

二、在pom.xml中配置

<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>  
上一篇 下一篇

猜你喜欢

热点阅读