3

我有一个包含许多子项目的应用程序,目前我使用 maven2 将其编译并打包到 EAR,然后部署在 JBOSS 4.2.3 上。

到目前为止,所有 jar 都位于 EAR 根目录中,但现在我们移至 JBOSS 7.1,为了让一个 jar 被其他 jar 识别(我需要 Commons 项目可用于所有其他项目),它必须位于EAR/lib(这是 JBOSS 7.1 要求)。

我的问题是,如何告诉 Maven 将特定的 jar 复制到 EAR/lib?

/ *更新** /

这是我用来构建 EAR 的:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
                <outputDirectory>../../outputs/java</outputDirectory>
                <version>5</version>
                <modules>
                    <jarModule>
                        <groupId>com.example.common</groupId>
                        <artifactId>common</artifactId>
                        <includeInApplicationXml>
                            true
                        </includeInApplicationXml>
                    </jarModule>
                    .....
                </modules>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>ear</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <sourceDirectory>EarContent</sourceDirectory>
    <resources>
        <resource>
            <directory>EarContent\META-INF</directory>
            <targetPath>../Manager-1.0/META-INF</targetPath>
            <excludes>
                <exclude>application.xml</exclude>
            </excludes>
        </resource>
    </resources>
</build>
4

1 回答 1

5

EAR 插件的bundleDir属性看起来像您的问题的解决方案:http ://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-module-location.html

Maven 文档中的示例允许您定义每个模块的位置或作为所有模块的默认位置。

于 2012-02-29T10:20:33.777 回答