Maven:将依赖jar放到不同的war文件夹而不是war / web-inf / lib

时间:2010-11-24 10:52:30

标签: web-services maven-2 maven axis2

目前我正在尝试为基于axis2的项目制作maven构建任务 在我的pom.xml我已经定义了依赖jar文件。我希望在战争建立时,jar会被移动到另一个目录:不在war/web-inf/lib而是在war/web-inf/servicejars

我在stackoverflow上查看了类似的问题,但是他们没有帮助。

    <dependencies>
        <dependency>
            <groupId>mycompany</groupId>
            <artifactId>MyService</artifactId>
            <!-- didnt work for me -->
            <!--<properties>-->
                <!--<war.target.path>servicejars</war.target.path>-->
            <!--</properties>-->
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>1.5.2</version>
        </dependency>
        <!-- etc ... -->
    </dependencies>
    <build>
        <finalName>Axis2</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                </configuration>
                <extensions>true</extensions>
            </plugin>
            <!--<plugin> Didn't worked too-->
                <!--<groupId>org.apache.maven.plugins</groupId>-->
                <!--<artifactId>maven-dependency-plugin</artifactId>-->
                <!--<version>2.1</version>-->
                <!--<executions>-->
                    <!--<execution>-->
                        <!--<id>copydep</id>-->
                        <!--<phase>prepare-package</phase>-->
                        <!--<goals>-->
                            <!--<goal>copy-dependencies</goal>-->
                        <!--</goals>-->
                        <!--<inherited>false</inherited>-->
                        <!--<configuration>-->
                            <!--<includeArtifactIds>MyService</includeArtifactIds>-->
                            <!--<outputDirectory>$project.build.directory/${project.build.finalName}/web-inf/servicejars</outputDirectory>-->
                        <!--</configuration>-->
                    <!--</execution>-->
                <!--</executions>-->
            <!--</plugin>-->
        </plugins>
    </build>

提前致谢。

1 个答案:

答案 0 :(得分:1)

查看Maven assembly plugin。您可以使用assembly descriptor filedir格式执行此操作。可能不是你想要的例子,但是一个好的起点是他们提供插件文档的例子:http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/including-and-excluding-artifacts.html

以下是汇编描述符模型外观的良好链接:http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html

相关问题