eclipse maven打包找不到rt.jar下的类
2019-11-07 本文已影响0人
岁月静好忄
程序在eclipse中运行正常,maven打包的时候找不到rt.jar下的类
解决方法:
方法一
新建环境变量:CLASS_PATH
值为:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
方法二 加入compilerArguments
配置
<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>
<encoding>UTF-8</encoding>
<compilerArguments>
<verbose />
<bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>