在 Jenkins 中,使用 maven 打包报 package xxx does not exist 问题的解决方法
2017-06-21 17:02
555 查看
1 发现问题
今天打算使用 Jenkins 给一些旧项目打包,编译时报以下错误:... [ERROR] /var/lib/jenkins/workspace/fsti-pipe/src/main/java/com/fsti/oss/service/sys/PagerService.java:[6,52] package org.springframework.beans.factory.annotation does not exist ...
看日志,直接原因是 spring 的 某些 jar 包不存在!
2 寻找原因
在本地开发环境下,用 idea 的 maven 搭建了与 Jenkins 相同的 maven 环境(启用了新的本地仓库、使用相同版本的 maven-compiler-plugin),可以正常编译!这说明一定是其他原因造成的。在 Jenkins 中,打开对应项目的【配置】链接,然后点击【构建】页签,在 Goals 中为 Maven 加入
-e -X参数,并保存:
这样会让 Maven 在构建时打印出更详细的日志。
现在项目再重新构建一次,再看看输出的日志。
配置的仓库已经被使用咯,说明仓库的配置没有问题:
[DEBUG] Using mirror nexus (http://xxx:8383/nexus/content/groups/public/) for snapshots (http://xxx:8081/nexus/content/repositories/snapshots). ... [DEBUG] Repositories (dependencies): [nexus-all (http://xxx:8081/nexus/content/groups/public, default, releases+snapshots), nexus (http://xxx:8383/nexus/content/groups/public/, default, releases+snapshots)] ...
jdk 打包时引用的依赖包路径有问题,居然会是
/xxx/D:\Program Files\apache-maven\repo...格式的,这很明显不是 linux 的正确路径嘛:
[DEBUG] -d /var/lib/jenkins/workspace/fsti-pipe/target/classes -classpath /var/lib/jenkins/workspace/fsti-pipe/target/classes:/var/lib/jenkins/workspace/fsti-pipe/D:\Program Files\apache-maven\repo/com/fsti/agile/fsti-agile/1.1.1/fsti-agile-1.1.1.jar: ...
至此可以确定是 maven 的 setting.xml 里面的 localRepository 配置路径的不对,造成了上述问题。一看果然是这样:
3 解决问题
把 maven 的 setting.xml 的 localRepository 改为正确的配置路径即可!记住这个路径在 linux 中必须有读写权限的哦 O(∩_∩)O~相关文章推荐
- android中,使用ant多渠道打包时出现Perhaps JAVA_HOME does not point to the JDK问题的解决方法
- Error: Activity class {XXX} does not exist的问题解决
- 复制Android Studio 工程到其它电脑后遇到The SDK directory 'XXXX‘ does not exist.问题的解决方法
- The project: nameXXX which is referenced by the classpath, does not exist解决方法?
- mySql问题:The user specified as a definer ('root'@'%') does not exist 解决方法
- tomcat7解决package javax.servlet does not exist的问题
- java.lang.IllegalArgumentException: column 'xxx' does not exist解决方法
- mysql:The user specified as a definer ('xxx'@'%') does not exist 解决方法
- Android中的ActivityManager: Error: Activity class {XXX} does not exist的问题解决
- mysql权限问题_mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解决方法
- File xxx specified for property 'resourceFile' does not exist.解决方法
- The user specified as a definer ('root'@'%') does not exist 解决方法 权限问题
- because the principal "dbo" does not exist 问题解决方法
- Bootstrap: command Tomcat 5.5\conf\server.xml" does not exist. eclipe启动tomcat问题解决方法
- android里出现"resource directory /xxx/res does not exist"问题的解决办法
- File xxx specified for property 'resourceFile' does not exist.解决方法
- 使用ANT编译项目报错 com.sun.image.codec.jpeg does not exist 解决方法
- 使用ANT编译项目报错 com.sun.image.codec.jpeg does not exist 解决方法
- 使用m2e将工程转化为maven工程后eclipse报Plugin execution not covered by lifecycle configuration:xxx plugin问题的解决方法
- because the principal "dbo" does not exist 问题解决方法