繁体   English   中英

如何在没有子 jar 的情况下包含 jar

[英]How to include a jar without its subjar

我有一个struts项目。 它的APP-INF/lib目录下有很多jars,打包后的耳朵很大。 我还有另一个 spring 引导项目,它有一个实用程序 class。

我的目标是使用 struts 项目中的那个实用程序。

The problem here is, if I include this spring-boot jar in the pom.xml , it includes the spring boot jar with all its dependency which are already present in the struts project. 这使得耳朵更大。 jars 以某种方式复制了两次。 基本上项目变成了这样:

struts-project
--APP-INF/libs/
----**.jar (many jars)
----spring-boot-project.jar
--------BOOT-CONF/libs/
-------------**.jar (again many jars, most of them already in one level above directory)

我的最终目标是使用该实用程序,对此我有两种方法(我的想法,可能有更多方法)

  1. 包括 spring 引导 jar,但要找到减小封装耳尺寸的方法。

  2. 在 spirng boot 项目中创建一个 rest api 只是为了使用 jar。 但是如果服务无论如何都关闭了,它将对主应用程序产生巨大影响 - 所以也不想使用这种方式。

请提出更多实现我最终目标的方法。 或上述方法中的任何改进/建议。

为了在许多项目中使用实用程序/公共类,您应该为实用程序创建单独的项目。

实用项目不应使用任何依赖项或很少使用,否则您应该重新设计它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM