• Category Archives: Jenkins

maven构建项目时出现”程序包javax.crypto不存在”

错误日志片段如下:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.717 s
[INFO] Finished at: 2019-11-29T18:05:11+08:00
[INFO] Final Memory: 47M/3925M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project csw-20190626-monsterHotel: Compilation failure: Compilation failure:
[ERROR] /D:/Workspaces/csw-20190626-monsterHotel/src/main/java/com/zero4j/model/token/util/AEScbcUtil.java:[10,20] 程序包javax.crypto不存在
[ERROR] /D:/Workspaces/csw-20190626-monsterHotel/src/main/java/com/zero4j/model/token/util/AEScbcUtil.java:[11,20] 程序包javax.crypto不存在
[ERROR] /D:/Workspaces/csw-20190626-monsterHotel/src/main/java/com/zero4j/model/token/util/AEScbcUtil.java:[12,20] 程序包javax.crypto不存在
[ERROR] /D:/Workspaces/csw-20190626-monsterHotel/src/main/java/com/zero4j/model/token/util/AEScbcUtil.java:[13,25] 程序包javax.crypto.spec不存在
[ERROR] /D:/Workspaces/csw-20190626-monsterHotel/src/main/java/com/zero4j/model/token/util/AEScbcUtil.java:[14,25] 程序包javax.crypto.spec不存在
[ERROR] /D:/Workspaces/csw-20190626-monsterHotel/src/main/java/com/zero4j/model/token/util/AEScbcUtil.java:[32,9] 找不到符号
[ERROR] 符号:   类 KeyGenerator
[ERROR] 位置: 类 com.zero4j.model.token.util.AEScbcUtil
[ERROR] /D:/Workspaces/csw-20190626-monsterHotel/src/main/java/com/zero4j/model/token/util/AEScbcUtil.java:[32,37] 找不到符号
[ERROR] 符号:   变量 KeyGenerator
[ERROR] 位置: 类 com.zero4j.model.token.util.AEScbcUtil
[ERROR] /D:/Workspaces/csw-20190626-monsterHotel/src/main/java/com/zero4j/model/token/util/AEScbcUtil.java:[34,9] 找不到符号
[ERROR] 符号:   类 SecretKey
[ERROR] 位置: 类 com.zero4j.model.token.util.A

在maven的pom.xml中的plugins的maven插件的bootclasspath参数补上”${JAVA_HOME}/lib/jce.jar”, 见下面代码:

			<!-- 解决:程序包com.sun.xml.internal.ws.util不存在 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<compilerArguments>
						<!-- rt.jar和jce.jar中间的分隔符,windows为“;”,linux为“:” -->
						<bootclasspath>${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/jre/lib/jce.jar</bootclasspath>
					</compilerArguments>
				</configuration>
			</plugin>

 

close