相关疑难解决方法(0)

如何在maven构建期间覆盖WAR文件中的文件?

我有一个Java webapp项目,我在Eclipse(更准确地说是MyEclipse 10)中开发并使用Maven 3构建.

我有以下布局(仅包括与我的问题相关的文件:

project root
|-- src
|   |-- main
|   |   |-- java
|   |   |-- resources
|   |   |   |-- log4j.xml
|   |   |   +-- struts.properties
|   |   |-- webapp
|   |   |   |-- META-INF
|   |   |   |   +--context.xml
|   |   |-- config
|   |   |   |-- test
|   |   |   |   |--log4j.xml
|   |   |   |   |--struts.properties
|   |   |   |   +--context.xml
|   |   |   +-- prod
|   |   |   |   |--log4j.xml
|   | …
Run Code Online (Sandbox Code Playgroud)

eclipse myeclipse maven maven-war-plugin maven-profiles

10
推荐指数
1
解决办法
2万
查看次数

在建立战争时,文件在maven项目中被覆盖

我正在使用maven构建一个Web应用程序项目,并且打包设置为"war".我还使用YUI压缩器插件来压缩webapp目录中的javascript代码.我已经设置了YUI压缩器,如下所示:

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>1.3.0</version>
    <executions>
        <execution>
        <phase>process-resources</phase>
        <goals>
            <goal>compress</goal>
        </goals>
        </execution>
    </executions>
    <configuration>
        <excludes>
        <exclude>**/ext-2.0/**/*.js</exclude>
        <exclude>**/lang/*.js</exclude>
        <exclude>**/javascripts/flot/*.js</exclude>
        <exclude>**/javascripts/jqplot/*.js</exclude>
        </excludes>
        <nosuffix>true</nosuffix>
        <force>true</force>
        <jswarn>false</jswarn>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

如果我这样做:mvn process-resources,src/main/webapp将被复制到target/webapp-1.0 /目录,并压缩javacripts.但是,当我运行mvn install时,所有压缩的javascripts都会被覆盖,显然打包过程会在构建war文件之前从main/webapp复制一次内容.

我怎么能绕过这个?

yui-compressor maven maven-war-plugin

6
推荐指数
1
解决办法
8299
查看次数