Maven对原始Spring Boot JAR的依赖[重复]

时间:2023-01-25 22:37:12

This question already has an answer here:

这个问题在这里已有答案:

I'm using Spring Boot with the spring boot maven plugin which creates a JAR with

我正在使用Spring Boot和spring boot maven插件创建一个JAR

The JAR created by the plugin puts the classes in subdirectory in the JAR which means that I can't use the JAR as a dependency in maven.

插件创建的JAR将类放在JAR的子目录中,这意味着我不能将JAR用作maven中的依赖项。

Is there a way to declare a depenency in maven on the original JAR. I see that there is a *.jar.original file in the target directory so maybe I can create a dependency on that in the way it's possible to create a dependency on the test classes by declaring a dependency of the kind test-jar.

有没有办法在原始JAR上声明maven中的依赖性。我看到目标目录中有一个* .jar.original文件,所以也许我可以通过声明类型test-jar的依赖关系来创建对测试类的依赖关系。

Just for clarification: I'm doing this testing/easier debugging, not for production.

只是为了澄清:我正在进行此测试/更容易调试,而不是用于生产。

1 个解决方案

#1


2  

It's the other way around bout you can put a classifier to the Spring-Boot Jar in the repackage goal and let maven build your normal jar during the packaging phase: http://docs.spring.io/spring-boot/docs/current/maven-plugin/repackage-mojo.html#classifier

另一种方法是你可以在重新打包目标中将分类器放到Spring-Boot Jar中,让maven在打包阶段构建你的普通jar:http://docs.spring.io/spring-boot/docs/current /maven-plugin/repackage-mojo.html#classifier

#1


2  

It's the other way around bout you can put a classifier to the Spring-Boot Jar in the repackage goal and let maven build your normal jar during the packaging phase: http://docs.spring.io/spring-boot/docs/current/maven-plugin/repackage-mojo.html#classifier

另一种方法是你可以在重新打包目标中将分类器放到Spring-Boot Jar中,让maven在打包阶段构建你的普通jar:http://docs.spring.io/spring-boot/docs/current /maven-plugin/repackage-mojo.html#classifier