码迷,mamicode.com
首页 > 编程语言 > 详细

Spring-boot构建多模块依赖工程时,maven打包异常:程序包xxx不存在

时间:2018-11-25 16:16:14      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:===   文件   boot   build   通过   ack   命令   compiler   error   

在qizhi项目改版的时候, 所有代码都迁移好了, 但是compile的时候报程序包*****不存在, 具体到某一个类就是: 找不到符号. 下面这篇文章是正解

http://hbxflihua.iteye.com/blog/2431537

具体内容如下:

===========================+===========================+===========================+

项目

dw(父类工程,定义各模块,指定模块依赖jar版本)

|------------------------------

|--da-core    核心代码

|

|--da-manage  后台管理,依赖da-core

|

|--da-api     API接口,依赖da-api

|

|--da-demo    API接口DEMO

 

 

通过maven命令:mvn clean package -Dmaven.test.skip 进行打包编译报错,错误信息如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project dw-manage: Compilation failure: Compilation failure:

[ERROR] /xxx.java:[16,39] 程序包com.xx..xxx不存在

 

程序包是da-core工程的包,解压编译的jar文件发现该jar本打包成了spring-boot的可执行jar,这不是我想要的结果。

 

原有的da-core包中maven插件配置如下:

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

 

调整后如下:

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<classifier>exec</classifier>
				</configuration>
			</plugin>
		</plugins>
	</build>

 

spring-boot工程打包编译时,会生成两种jar包,一种是普通的jar,另一种是可执行jar。默认情况下,这两种jar的名称相同,在不做配置的情况下,普通的jar先生成,可执行jar后生成,所以可执行jar会覆盖普通的jar。

===========================+===========================+===========================+===========================+

Spring-boot构建多模块依赖工程时,maven打包异常:程序包xxx不存在

标签:===   文件   boot   build   通过   ack   命令   compiler   error   

原文地址:https://www.cnblogs.com/ITPower/p/10015471.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!