蚂蚁Maven的 - 多个构建目标 [英] Ant to Maven - multiple build targets

查看:145
本文介绍了蚂蚁Maven的 - 多个构建目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Ant构建当前正在转化为Maven的。然而,Ant构建有2个构建目标 - 一个构建整个应用程序,以及一个从其中的一些文件建立一个JAR(只有几个)。在蚂蚁,很容易有多个构建目标来处理这个问题,但我想,以确定Maven来处理这个问题的最好办法。

I have an Ant build that is currently being converted to Maven. However, the Ant build has 2 build targets - one that builds the entire app, and one that builds a JAR from some of those files (only a few). In Ant, it's easy to have multiple build targets to handle this, but I'm trying to determine the best way to handle this in Maven.

我的文件的子集拆分成第二个项目,它会有自己的POM。然后第一个项目可能会依赖它。然而,因为文件的子集是如此之小(小于10),它看起来像它可能是矫枉过正拥有该一个全新的项目。

I could split the subset of files into a second project and it will have its own POM. Then the first project could depend on this one. However, since the subset of files is so small (less than 10), it seems like it might be overkill to have an entirely new project for that.

还有没有其他的方式来处理呢?

Are there other ways to handle this?

推荐答案

您首先想到的就是正确的。拆分2块放入2个项目。

Your first thought is the correct one. Split the 2 pieces into 2 projects.

Maven的理念是,每个项目应该建立唯一神器(JAR,WAR等等)

The maven philosophy is that each project should build one and only artifact (jar, war, whatever)

您也许可以砍的东西在一起,使你只有一个Maven项目建设2 atrifacts,但它是一个黑客攻击。

You could probably hack something together so that you only have one maven project building 2 atrifacts, but it would be a hack.

您还可以从Maven的蚂蚁,所以如果你真的想这样做的话,我建议你开始看的Maven插件蚂蚁。神器ID是Maven的antrun-插件

You can call ant from maven, so if you really want to do this, then I suggest you start looking at the maven ant plugin. The artifact id is "maven-antrun-plugin"

这篇关于蚂蚁Maven的 - 多个构建目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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