【问题标题】:Howto reference a WAR from a vendor in my own project如何在我自己的项目中引用供应商的 WAR
【发布时间】:2011-11-14 18:29:19
【问题描述】:

我想根据从软件供应商处获得的战争文件用 maven 构建一个战争文件。来自供应商的 war 文件包含 WEB-INF/classes 中的类和 WEB-INF/lib 中的 jar。

我能够在 warpath 插件的帮助下引用 classes 文件夹,但不能引用 lib 文件夹中的 jar。有没有办法做到这一点?

这是我正在使用的 pom.xml。

<dependencies>
    <dependency>
        <groupId>com.vendor</groupId>
        <artifactId>vendor-web-app</artifactId>
        <type>war</type>
    </dependency>
    <dependency>
        <groupId>com.vendor</groupId>
        <artifactId>vendor-web-app</artifactId>
        <type>warpath</type>
    </dependency>
<!-- ... other dependencies...-->
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <dependentWarExcludes>WEB-INF/lib/* </dependentWarExcludes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.appfuse.plugins</groupId>
            <artifactId>maven-warpath-plugin</artifactId>
            <version>2.1.0-M2</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <goals>
                        <goal>add-classes</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
<!-- ... other plugins ...-->

    </plugins>
</build>

我使用的是 maven 2 (2.2.1),因为 warpath 插件接缝不适用于 maven 3 (3.0.3)。

【问题讨论】:

    标签: java maven build war


    【解决方案1】:

    您可以在generate-resources 阶段unpack the war 并在package 阶段使用maven assembly plugin 包含其中的文件。

    【讨论】:

      猜你喜欢
      • 2016-04-06
      • 2014-02-26
      • 1970-01-01
      • 1970-01-01
      • 2012-10-23
      • 2012-10-03
      • 2014-12-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多