添加 .mf 和Maven 构建的 EAR 内 META-INF 目录中的 .xml 文件
我有任意 .xml &我必须将 .mf 文件添加到耳朵本身内的 META-INF 文件夹中。使用maven2.2.1完成构建。只需将这些文件添加到 ${basedir}/src/main/application/META-INF/ 下就可以了,但它不符合我的需求。还有另一种方法可以做这样的事情吗?我尝试过:
<build>
<resources>
<resource>
<directory>G:/WS/vermeg/ear2/XML's</directory>
<targetPath>META-INF</targetPath>
</resource>
</resources>
</build>
但这不会在 EAR 本身下添加我的 xml 文件。
我也尝试过:
<configuration>
<earSourceDirectory>G:\WS\vermeg\ear2\XML's\</earSourceDirectory>
...
</configuration>
此命令将我的文件添加到耳朵内,但不在 EAR 内的 META-INF 中(myEar.ear/META-INF)。
欢迎任何帮助,并且会很棒。谢谢。
纳塞夫,
I have arbitrary .xml & .mf files that i have to add in the META-INF folder inside the ear itself. Build is done using maven2.2.1. Simply adding those files under ${basedir}/src/main/application/META-INF/ works fine, but it doesn't fit my needs. Is there another way to do such thing? I tried:
<build>
<resources>
<resource>
<directory>G:/WS/vermeg/ear2/XML's</directory>
<targetPath>META-INF</targetPath>
</resource>
</resources>
</build>
but this doesn't add my xml files under the EAR itself.
I also tried:
<configuration>
<earSourceDirectory>G:\WS\vermeg\ear2\XML's\</earSourceDirectory>
...
</configuration>
this commands add my files inside the ear, but NOT in the META-INF inside the EAR (myEar.ear/META-INF).
Any help is welcome, and would be great. Thnx.
nacef,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用此处描述的资源插件: http:// maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
Try using the resources plugin as described here: http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
我得到了它。谢谢杰吉夫。
我确实使用了 maven-resources-plugin,指定了我的 xml 所在的位置,并且我希望在“验证”阶段将它们复制到项目的 META-INF 文件夹中,这很重要。我的 pom 现在看起来像这样:
当执行 mvn clean install 时,maven 首先执行“验证”阶段,以便在打包 Ear 之前完成复制。那是成功的。
I got it. Thanx Jgiff.
I used indeed the maven-resources-plugin, specified where my xml's are located and that i wanted them to be copied in the META-INF folder of the project during the "validate" phase, that's important. My pom looks somehow like this now:
When executing an mvn clean install, maven executes the "validate" phase first so the copy is done before packaging the ear. That was successful.
我将为使用 IBM Rational Application Developer (RAD) 生成策略和绑定文件以部署到 WebSphere Application Server (WAS) 时遇到此问题的任何人添加此附加详细信息。
在我们的例子中,我们使用策略集附件的 RAD 工具生成策略绑定文件(policyAttachments.xml 和 wsPolicyServiceControl.xml)。默认情况下,它们被转储到 EAR 项目根目录中的 META-INF 文件夹中。如果有一种方便的方法来修改此默认行为以始终将其放入 application/META-INF 中,我没有遇到它。但上述方法在带有 m2e 的 RAD 中运行良好,可以在本地运行并构建 EAR。
这是我的 pom 中用于复制这些文件的部分:
I'll add this additional detail for anyone who encounters this problem using IBM Rational Application Developer (RAD) to generate policy and binding files for deployment to WebSphere Application Server (WAS).
In our case we generated policy binding files (policyAttachments.xml and wsPolicyServiceControl.xml) using the RAD tools for Policy set attachments. By default these get dumped into a META-INF folder in the EAR project root. If there is a handy way to modify this default behavior to always put it into application/META-INF, I did not come across it. But above methods work just fine in RAD with m2e for running locally and building EARs.
Here is the section of my pom used to copy those files: