Maven依赖项目 - 没有jar但是类 [英] Maven depend on project - no jar but classes

查看:136
本文介绍了Maven依赖项目 - 没有jar但是类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多模块Maven项目A.有两个模块:B和C,其中C取决于B。



我们假设C是一个Web应用程序,所以默认情况下B.jar将被包含在C的WEB-INF / lib目录中。



但是,我要编译B,然后移动它的编译类到C的目标目录。



如何在Maven中实现?



谢谢对于您的答案,



balázs

解决方案

如果您的模块> B 也是一个webapp模块,你可以通过c 配置战争插件。然后,您可以通过添加< classifier> classes< / classifier> 根据 -classes code>到pom。



否则你可以使用依赖插件来解压缩

I have a multi-module Maven project A. There are two modules: B and C, where C depends on B.

Let's say C is a web application, so by default B.jar would be included in the WEB-INF/lib directory of C.

But instead of this, I want to compile B, and then move its compiled classes to the target directory of C.

How can I achieve this in Maven?

Thank you for your answers,

balázs

解决方案

If your module B is also a webapp module, you can create a jar file containing only the classes simply by configuring the war plugin. You can then make C depend on that -classes artifact by adding <classifier>classes</classifier> to the pom.

Otherwise you can use the dependency plugin to unpack the B artifact when C is packaged.

这篇关于Maven依赖项目 - 没有jar但是类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆