如何在不使用Maven的情况下排除特定包的依赖分配?
- 内容介绍
- 文章标签
- 相关推荐
本文共计263个文字,预计阅读时间需要2分钟。
我有一个Maven项目,包含以下包(仅作示例):xml com.example library1 1.0.0 com.example library2 2.0.0
Ihaveamavenprojectwiththefollowingpackages(forillustrationonly):我有一个包含以下包的maven项目(仅供参考):I have a maven project with the following packages (for illustration only):
我有一个包含以下包的maven项目(仅供参考):
Root: src/main/java
- /com/foo
- /com/foo/api
- /com/foo/impl
Now I want to create a jar which includes only code in /com/foo/api and /com/foo/impl.
现在我想创建一个jar,其中只包含/ com / foo / api和/ com / foo / impl中的代码。
How does one hack pom.xml to do this ? Thanks all.
如何破解pom.xml来做到这一点?谢谢大家。
1 个解决方案
#1
1
Easy, use the tag on the jar plugin:
很简单,使用jar插件上的 标签:
org.apache.maven.plugins maven-jar-plugin /com/foo/api/* /com/foo/impl/*There's a section on including/excluding in the usage section of the plugin doc.
在插件文档的使用部分中有一个关于包含/排除的部分。
本文共计263个文字,预计阅读时间需要2分钟。
我有一个Maven项目,包含以下包(仅作示例):xml com.example library1 1.0.0 com.example library2 2.0.0
Ihaveamavenprojectwiththefollowingpackages(forillustrationonly):我有一个包含以下包的maven项目(仅供参考):I have a maven project with the following packages (for illustration only):
我有一个包含以下包的maven项目(仅供参考):
Root: src/main/java
- /com/foo
- /com/foo/api
- /com/foo/impl
Now I want to create a jar which includes only code in /com/foo/api and /com/foo/impl.
现在我想创建一个jar,其中只包含/ com / foo / api和/ com / foo / impl中的代码。
How does one hack pom.xml to do this ? Thanks all.
如何破解pom.xml来做到这一点?谢谢大家。
1 个解决方案
#1
1
Easy, use the tag on the jar plugin:
很简单,使用jar插件上的 标签:
org.apache.maven.plugins maven-jar-plugin /com/foo/api/* /com/foo/impl/*There's a section on including/excluding in the usage section of the plugin doc.
在插件文档的使用部分中有一个关于包含/排除的部分。

