部署jenkins的时候出现了下面的错误 :
/D:/jenkinsdata/workspace/124_58_digital_tour_class/src/main/java/com/bc/tour/service/tourPC/impl/PaymentManagementServiceImpl.java:[13,67] 程序包com.sun.xml.internal.messaging.saaj.packaging.mime.internet不存在
原因是因为 : javac在编译时,并不引用 rt.jar,用的是一个特别的symbol table(lib/ct.sym),这个symbol table不包含所有的sun包的类。由于rt.jar中一些类对访问具有限制,导致不解除这些限制的话会编译不通过,报:程序包XXXXXX不存在 的错误。
-XDignore.symbol.file的作用:告诉javac编译时会引用rt.jar而不是通过symbol table。
通过下面的插件代码就可以解决这个问题
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-XDignore.symbol.file</arg>
</compilerArgs>
<fork>true</fork>
</configuration>
</plugin>