添加 .mf 和Maven 构建的 EAR 内 META-INF 目录中的 .xml 文件

发布于 2024-10-04 01:20:53 字数 759 浏览 5 评论 0原文

我有任意 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

几味少女 2024-10-11 01:20:53

我得到了它。谢谢杰吉夫。
我确实使用了 maven-resources-plugin,指定了我的 xml 所在的位置,并且我希望在“验证”阶段将它们复制到项目的 META-INF 文件夹中,这很重要。我的 pom 现在看起来像这样:

 <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-resources-plugin</artifactId>
           <version>2.4.3</version>
            <executions>
            <execution>
                <id>copy-resources</id>
                    <phase>validate</phase>
                    <goals>
                    <goal>copy-resources</goal>
                    </goals>
    <configuration>
       <outputDirectory>G:\WS\vermeg\ear2\src\main\application\META-INF\</outputDirectory>
            <resources>
            <resource>
                <directory>G:\WS\vermeg\ear2\XML's</directory>
                <filtering>true</filtering>
            </resource>
            </resources>
            </configuration>
            </execution>
            </executions>
        </plugin>

当执行 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:

 <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-resources-plugin</artifactId>
           <version>2.4.3</version>
            <executions>
            <execution>
                <id>copy-resources</id>
                    <phase>validate</phase>
                    <goals>
                    <goal>copy-resources</goal>
                    </goals>
    <configuration>
       <outputDirectory>G:\WS\vermeg\ear2\src\main\application\META-INF\</outputDirectory>
            <resources>
            <resource>
                <directory>G:\WS\vermeg\ear2\XML's</directory>
                <filtering>true</filtering>
            </resource>
            </resources>
            </configuration>
            </execution>
            </executions>
        </plugin>

When executing an mvn clean install, maven executes the "validate" phase first so the copy is done before packaging the ear. That was successful.

凉月流沐 2024-10-11 01:20:53

我将为使用 IBM Rational Application Developer (RAD) 生成策略和绑定文件以部署到 WebSphere Application Server (WAS) 时遇到此问题的任何人添加此附加详细信息。

在我们的例子中,我们使用策略集附件的 RAD 工具生成策略绑定文件(policyAttachments.xml 和 wsPolicyServiceControl.xml)。默认情况下,它们被转储到 EAR 项目根目录中的 META-INF 文件夹中。如果有一种方便的方法来修改此默认行为以始终将其放入 application/META-INF 中,我没有遇到它。但上述方法在带有 m2e 的 RAD 中运行良好,可以在本地运行并构建 EAR。

这是我的 pom 中用于复制这些文件的部分:

     <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-resources-plugin</artifactId>
         <version>2.4.3</version>
         <executions>
             <execution>
                 <id>copy-resources</id>
                 <phase>validate</phase>
                 <goals>
                     <goal>copy-resources</goal>
                 </goals>
                 <configuration>
                     <outputDirectory>${basedir}\src\main\application\META-INF\</outputDirectory>
                     <resources>
                         <resource>
                             <directory>${basedir}\META-INF</directory>
                             <filtering>true</filtering>
                         </resource>
                     </resources>
                 </configuration>
             </execution>
         </executions>
     </plugin>

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:

     <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-resources-plugin</artifactId>
         <version>2.4.3</version>
         <executions>
             <execution>
                 <id>copy-resources</id>
                 <phase>validate</phase>
                 <goals>
                     <goal>copy-resources</goal>
                 </goals>
                 <configuration>
                     <outputDirectory>${basedir}\src\main\application\META-INF\</outputDirectory>
                     <resources>
                         <resource>
                             <directory>${basedir}\META-INF</directory>
                             <filtering>true</filtering>
                         </resource>
                     </resources>
                 </configuration>
             </execution>
         </executions>
     </plugin>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文