如何告诉Maven将某个项目jar复制到EAR lib?

Tom*_*mer 3 java maven-2 jboss7.x maven-ear-plugin

我有一个包含许多子项目的应用程序,当前我使用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>
Run Code Online (Sandbox Code Playgroud)

nwi*_*ler 5

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

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