maven打包user-thrift-service服务出错
来源:4-6 三大平台扬帆起航
wujunwei
2018-10-14
老师好,我把项目下载后直接将user-thrift-service-api工程mvn install到本地仓库,该步骤成功通过,但就在将user-thrift-service用mvn package打包的时候,会出现如下错误,提示应该是找不到api的jar包
- user-thrift-service-api安装成功的日志
/usr/local/jdk1.8.0_161/bin/java -Dmaven.multiModuleProjectDirectory=/home/echo/workspace/java/springboot/coding-198/user-thrift-service-api -Dmaven.home=/usr/local/apache-maven-3.5.3 -Dclassworlds.conf=/usr/local/apache-maven-3.5.3/bin/m2.conf -javaagent:/home/echo/Desktop/Intellij/lib/idea_rt.jar=41471:/home/echo/Desktop/Intellij/bin -Dfile.encoding=UTF-8 -classpath /usr/local/apache-maven-3.5.3/boot/plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.3.5 -s /usr/local/apache-maven-3.5.3/conf/settings.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.imooc:user-thrift-service-api >------------------
[INFO] Building user-thrift-service-api 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ user-thrift-service-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/echo/workspace/java/springboot/coding-198/user-thrift-service-api/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ user-thrift-service-api ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /home/echo/workspace/java/springboot/coding-198/user-thrift-service-api/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ user-thrift-service-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/echo/workspace/java/springboot/coding-198/user-thrift-service-api/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ user-thrift-service-api ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ user-thrift-service-api ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ user-thrift-service-api ---
[INFO] Building jar: /home/echo/workspace/java/springboot/coding-198/user-thrift-service-api/target/user-thrift-service-api-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ user-thrift-service-api ---
[INFO] Installing /home/echo/workspace/java/springboot/coding-198/user-thrift-service-api/target/user-thrift-service-api-1.0-SNAPSHOT.jar to /usr/local/localRepo/com/imooc/user-thrift-service-api/1.0-SNAPSHOT/user-thrift-service-api-1.0-SNAPSHOT.jar
[INFO] Installing /home/echo/workspace/java/springboot/coding-198/user-thrift-service-api/pom.xml to /usr/local/localRepo/com/imooc/user-thrift-service-api/1.0-SNAPSHOT/user-thrift-service-api-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.616 s
[INFO] Finished at: 2018-10-14T17:14:19+08:00
[INFO] ------------------------------------------------------------------------
- user-thrift-service打包出错的日志
/usr/local/jdk1.8.0_161/bin/java -Dmaven.multiModuleProjectDirectory=/home/echo/workspace/java/springboot/coding-198/user-thrift-service -Dmaven.home=/usr/local/apache-maven-3.5.3 -Dclassworlds.conf=/usr/local/apache-maven-3.5.3/bin/m2.conf -javaagent:/home/echo/Desktop/Intellij/lib/idea_rt.jar=36226:/home/echo/Desktop/Intellij/bin -Dfile.encoding=UTF-8 -classpath /usr/local/apache-maven-3.5.3/boot/plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.3.5 -s /usr/local/apache-maven-3.5.3/conf/settings.xml package
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.imooc:user-thrift-service:jar:1.0-SNAPSHOT
[WARNING] 'parent.relativePath' of POM com.imooc:user-thrift-service:1.0-SNAPSHOT (/home/echo/workspace/java/springboot/coding-198/user-thrift-service/pom.xml) points at com.imooc:micro-service instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 5, column 13
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------------------< com.imooc:user-thrift-service >--------------------
[INFO] Building user-thrift-service 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.447 s
[INFO] Finished at: 2018-10-14T17:16:54+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project user-thrift-service: Could not resolve dependencies for project com.imooc:user-thrift-service:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.imooc:user-thrift-service-api:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for com.imooc:user-thrift-service-api:jar:1.0-SNAPSHOT: Could not find artifact com.imooc:micro-service:pom:1.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
我的编译环境是jdk1.8,maven-3.5.3的
写回答
3回答
-
仔细看一下哦:
install的jar包名字是:user-thrift-service-api-1.0-SNAPSHOT.jar
找不到的jar包名字是:user-thrift-service-api:jar:1.0-SNAPSHOT012018-10-15 -
wujunwei
提问者
2018-10-14
我后来在项目根目录上面直接输入maven clean install -Dmaven.test.skip=true命令,虽然还会报zuul的问题,但再user-thrift-service项目中,重新maven clean package就可以打包成功了,主要参考了以下链接https://blog.csdn.net/liqi_q/article/details/80557157
40 -
吴小波
2019-06-18
没有安装root模块jar
012019-08-12
相似问题