如何将依赖关系包含在文件名中没有版本的EAR中 [英] How to include dependencies into an EAR without version in the file name

查看:114
本文介绍了如何将依赖关系包含在文件名中没有版本的EAR中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用maven创建 .ear

I am creating .ear using maven

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-ear-plugin</artifactId>
  <version>2.6</version>
  <configuration>
    <finalName>wsformatter-ear</finalName>
    <includeLibInApplicationXml>true</includeLibInApplicationXml>
    <version>1.4</version>
  </configuration>
</plugin>  

.ear中的所有依赖关系如下所示: joda-time-1.6.2.jar commons-io-1.4.jar 等。

All dependencies in the .ear look like joda-time-1.6.2.jar, commons-io-1.4.jar etc.

但是,我有依赖关系,我想要没有版本。例如,我该怎么做,这个依赖关系 slf4j-api-1.5.6.jar 将在我的 .ear 中看起来像 slf4j-api.jar em>

But also, I have dependencies, that I want have without version. For example, how can I do, that dependency slf4j-api-1.5.6.jar will look like slf4j-api.jar in my .ear

推荐答案

基本上,你不能(没有某种黑客攻击Maven的插件配置),即使你可以 - 只是不要。关于依赖关系的Maven方法和哲学对于它们是严格和直观的,包括将版本作为文件名后缀的默认约定。它只是立即说出使用哪个版本的工件。如果您依赖于经常发布的某些工件,您必须在EAR的POM中更新其版本,因此它的传播不是以某种方式进行自我效能。因此,我没有看到这个文件名后缀有任何问题。

Basically, you can't (without some kind of hacking on Maven's plugins' configuration) and even if you could - just don't. Maven approach and philosophy about dependencies is being strict and straight about them, including default convention of having version as file name suffix. It just immediately say which version of the artifact is used. If you depend on some artifact that is often released, you have to update its version in your EAR's POM anyway, so its "propagation" isn't somehow self-acting. Therefore, I don't see any problem with this file name suffix.

如果这需要频繁更改是有问题的,也许你应该考虑修改这个频繁发布神器的开发周期?也许你可以在同一个SNAPSHOT版本中延长一点时间?即使你频繁的内部版本(如夜总会),Maven也不会强迫你在每个版本(在Maven版本插件的意义上)碰到你的版本。只要你想要,你可以留下一些SNAPSHOT版本。即使在敏捷的敏捷流程(或看板)中,这种真实的发布通常每隔几周发生一次,而且可以长期管理。

If this need for frequent change is problematic for you, maybe you should consider to modify somehow this frequently released artifact's development cycle? Probably you can extend a little a time it spend during same SNAPSHOT version? Even if you do frequent "internal" releases (like nightbuilds), Maven doesn't force you to bump your version every release (in sense of Maven Release Plugin). You can stay with some SNAPSHOT version as long as you want. Even in really quick Agile processes (or Kanban) this kind of "real" release usually happens every few weeks and it's long enough to be manageable.

最后,不是这样我不会帮你(或这样的东西)或不想。我只是想你想要反对Maven。如果您接受并遵循其惯例和约定,那么Maven真的很强大。从我的经验来看,试图解决这个问题意味着问题(早晚)。我已经看到许多项目有Maven-like-Ant配置,许多开发人员抱怨Maven吸引人。在找出这些东西后,我说:Maven不吸,你的POM。

At the end, it's not like this I won't help you (or something like this) or don't want to. I just think you're trying to go against Maven. Maven is really powerful if you accept and go with its approach and conventions. From my experience, trying to get around this means problems (sooner or later). I've already seen many projects that had Maven-like-Ant configuration and many developers around complaining that Maven sucks. After figuring out the stuff there I said them: "Maven doesn't suck, your POMs do".

这篇关于如何将依赖关系包含在文件名中没有版本的EAR中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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