使用maven-compiler-plugin 时,定义以下,web
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
maven
咱们原本是用1.6的,后面须要编译一个1.5的包给其它人用,因而就把1.6改为1.5,后执行package, 结果怎么测试生成都不对,测试
几翻折腾,最后仍是看日志,发现这,晕,每次都没有从新编译,直接是拿着之前编译的打包了,spa
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @日志
[INFO] Nothing to compile - all classes are up to dateorm
因而就加个clean, 即clean packageget
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ YESsafeTokenServerSDK ---
[INFO] Changes detected - recompiling the module!it
从新编译了,而后看生成的class,也是对应版本的io
最后再说明下source和target做用编译
<source>1.6</source>//指定源代码的版本,若是是有一些不支持的特性,如范型,编译时会提示你哪些类有问题。<target>1.6</target>//指定class目标版本