我想我可能已经找到了解决办法:
在瘦战争教程,一个是应该jar添加WEB-INF/lib目录/ *到packagingExcludes。然后,将所有的依赖关系添加到耳朵配置中,使其可用于罐子。
问题是,war-packaged依赖不会将其传递依赖项添加到ear的lib文件夹中,所以它们或者需要找到自己的方式进入ear lib文件夹或WEB-INF/lib文件夹战争包。
我选择了最后一个,将它们添加到WAR文件的WEB-INF/lib中。
为此,首先通过执行mvn dependency:tree
来获取包含war/warpath资源的war项目的依赖关系树。
接下来,找到warpath的依赖关系。在我的情况下,它看起来像这样:
+- org.appfuse:appfuse-struts:warpath:2.0.2:compile
| +- org.appfuse:appfuse-web-common:war:2.0.2:compile
| +- org.appfuse:appfuse-web-common:warpath:2.0.2:compile
| +- displaytag:displaytag:jar:1.1.1:compile
| | \- org.slf4j:jcl104-over-slf4j:jar:1.4.2:compile
| +- commons-fileupload:commons-fileupload:jar:1.2.1:compile
| +- org.apache.commons:commons-io:jar:1.3.2:compile
| +- org.appfuse:appfuse-service:jar:2.0.2:compile
| | +- velocity:velocity:jar:1.4:compile
| | | \- velocity:velocity-dep:jar:1.4:runtime
| | +- org.codehaus.xfire:xfire-java5:jar:1.2.6:compile
| | | +- org.codehaus.xfire:xfire-aegis:jar:1.2.6:compile
| | | | \- net.java.dev.stax-utils:stax-utils:jar:20040917:compile
| | | +- org.codehaus.xfire:xfire-annotations:jar:1.2.6:compile
| | | +- xfire:xfire-jsr181-api:jar:1.0-M1:compile
| | | \- org.codehaus.xfire:xfire-core:jar:1.2.6:compile
| | | +- stax:stax-api:jar:1.0.1:compile
| | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.0:compile
| | | \- commons-httpclient:commons-httpclient:jar:3.0:compile
| | \- org.codehaus.xfire:xfire-spring:jar:1.2.6:compile
| | +- org.apache.xbean:xbean-spring:jar:2.8:compile
| | \- org.codehaus.xfire:xfire-xmlbeans:jar:1.2.6:compile
| | \- xmlbeans:xbean:jar:2.2.0:compile
| +- commons-dbcp:commons-dbcp:jar:1.2.2:compile
| | \- commons-pool:commons-pool:jar:1.3:compile
| +- org.directwebremoting:dwr:jar:2.0.1:compile
| +- javax.servlet:jstl:jar:1.1.2:compile
| +- taglibs:standard:jar:1.1.2:compile
| +- opensymphony:oscache:jar:2.3:compile
| +- opensymphony:sitemesh:jar:2.2.1:compile
| +- org.tuckey:urlrewritefilter:jar:3.0.4:compile
| \- commons-lang:commons-lang:jar:2.4:compile
因此,我们需要确保这些都可用。这可以通过更改WEB-INF/lib/*的包装排除来排除所有内容,而是排除除我们想保留的所有内容外的所有内容。
这可以这样做:
<packagingExcludes>
%regex[WEB-INF/lib/(?!clickstream|struts|appfuse|commons-fileupload|commons-dbcp|dwr|oscache|sitemesh|urlrewritefilter|commons-lang|velocity|xwork|commons-digester).*.jar]
</packagingExcludes>
这将使GlassFish的停止抱怨不被发现的类。我还没有到那里,所以可能需要包括更多的罐子,但它越来越近了。使一切工作后
我的全packagingExcludes正则表达式是这样的: %的正则表达式[WEB-INF/lib目录/(?!点击流|支柱|的appfuse |公地文件上传|公地DBCP | DWR | OSCache的|的sitemesh | urlrewritefilter |公地郎|速度| XWork的|公共沼气池| XFire软件| xbean | OGNL | freemarker的|。ActiveMQ的)*罐子] – Tobb 2012-08-16 10:19:07