maven包装不包括jars正则表达式

maven包装不包括jars正则表达式

本文介绍了maven包装不包括jars正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在EAR中有一些瘦的WAR。我需要排除除richafeces jar之外的所有war lib。

I have some skinny WARs in EAR. I need to exclude all the war libs except richafeces jars.

我在packagingExcludes中试过这个

I tried this in packagingExcludes

%regex[WEB-INF/lib/(?!richfaces).*.jar]

whitout成功。

whitout success.

怎么做?

如果我使用WEB-INF / lib / * .jar工作得很好,但是当使用正则表达式时,没有什么不起作用。
我正在使用maven-war-plugin的2.3版。

If I use WEB-INF/lib/*.jar work well, but when use regex something no is not working.I'm using version 2.3 of maven-war-plugin.

推荐答案

我认为这是一个老问题,所以你现在可能已经以某种方式解决了这个问题。我不知道为什么你的东西不起作用。我有类似的情况,这对我有用:

I see this is an old question, so you've probably resolved it one way or another by now. I'm not sure why what you have there wouldn't work. I have a similar situation and this is working for me:

<packagingExcludes>%regex[WEB-INF/lib/(?!servletbridge\.jar).*]</packagingExcludes>

我还尝试在列表中添加其他文件名,例如

I've also experimented with adding additional filenames to the list, e.g.

<packagingExcludes>%regex[WEB-INF/lib/(?!servletbridge\.jar)(?!secondFile\.jar).*]</packagingExcludes>

这对我来说也没有问题。也许正则表达式中的文件名拼写错误或未转义的字符? (就像.jar中的。一样?虽然从技术角度讲,未转义的点不应该破坏表达式,但由于点匹配任何字符(包括文字点),因此它的精确度会降低。)

This also worked for me without issue. Perhaps a filename typo or unescaped character in your regular expression? (Like the "." in ".jar"? Though technically an unescaped dot shouldn't break the expression, it would just make it less precise since a dot matches any character, including a literal dot.)

这篇关于maven包装不包括jars正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 06:48