首页 > 代码库 > maven打包日志输出优化-去掉泛型与过时的警告
maven打包日志输出优化-去掉泛型与过时的警告
pom.xml配置
1、使用eclipse编译
<!-- Eclipse编译代码时,使用的是自带的JDT(Java Development Tools),
而Maven默认使用的是JAVA_HONE中的javac,而javac相对JDT的检查机制来说,
更加的严格,所以导致Eclipse可以编译通过,而用Maven编译会报错的结果。-->
<build>
...
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerId>eclipse</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</plugin>
....
</plugins>
...
</build>
2、使用javac
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>UTF-8</encoding><!--解决GBK映射报错问题-->
<compilerId>javac</compilerId>
</configuration>
<dependencies>
<dependency>
<!--<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.2</version>-->
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac</artifactId>
<version>2.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-compiler-api -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
</plugin>
maven打包日志输出优化-去掉泛型与过时的警告