Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 2 maven war插件在多模块项目中的执行和筛选_Maven 2_Maven War Plugin - Fatal编程技术网

Maven 2 maven war插件在多模块项目中的执行和筛选

Maven 2 maven war插件在多模块项目中的执行和筛选,maven-2,maven-war-plugin,Maven 2,Maven War Plugin,我正在使用maven构建一个多模块项目 在一个项目中,我执行了四次maven war插件,以便在每次执行中过滤一些属性。作为一个独立的项目,它运行良好 但是,当我构建多模块时,从“父”开始,它执行四次,但没有一次过滤属性 谢谢大家! 下面是我的pom.xml的一个片段: <project> <modelVersion>4.0.0</modelVersion> <groupId>net.my</groupId> <artifac

我正在使用maven构建一个多模块项目

在一个项目中,我执行了四次maven war插件,以便在每次执行中过滤一些属性。作为一个独立的项目,它运行良好

但是,当我构建多模块时,从“父”开始,它执行四次,但没有一次过滤属性

谢谢大家!

下面是我的pom.xml的一个片段:

<project>  
<modelVersion>4.0.0</modelVersion>
<groupId>net.my</groupId>
<artifactId>my-project</artifactId>
<packaging>war</packaging>
<name>myProject</name>
<version>0.0.1</version>

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0</version>
        <executions>
            <execution>
                <id>list</id>
                <phase>package</phase>
                <goals>
                    <goal>war</goal>
                </goals>
                <configuration>
                    <warName>myProj-list.war</warName>
                    <webResources>
                        <resource>
                            <directory>src/main/webapp</directory>
                            <filtering>true</filtering>
                            <includes>
                                <include>**/*.xml</include>
                            </includes>
                        </resource>
                    </webResources>
                    <filtering>true</filtering>
                    <filters>
                        <filter>src/main/filters/list.properties</filter>
                    </filters>
                </configuration>
            </execution>  
            ...
            <!-- more executions -->
            </execution>
        </executions>
        <configuration>
            <webResources>
                <resource>
                    <directory>src/main/webapp</directory>
                    <filtering>true</filtering>
                    <includes>
                         <include>**/*.xml</include>
                      </includes>
                </resource>
             </webResources>
             <filters>
                <filter>src/main/filters/locator.properties</filter>
            </filters>
        </configuration>
    </plugin>
</plugins>
</build>

4.0.0
net.my
我的项目
战争
我的项目
0.0.1
org.apache.maven.plugins
maven战争插件
2
列表
包裹
战争
myProj-list.war
src/main/webapp
真的
**/*.xml
真的
src/main/filters/list.properties
...
src/main/webapp
真的
**/*.xml
src/main/filters/locator.properties
但是,当我构建多模块时,从“父”开始,它执行四次,但没有一次过滤属性

听起来像是一个复杂的设置。。。无论如何,您确定
src/main/webapp
的内容不会覆盖过滤后的内容吗?使用
-X
运行maven可能有助于调试正在发生的事情

我的建议是停止滥用滥用
webResources
元素(该元素应用于外部Web资源),并将需要过滤的内容移到
src/main/webapp
之外

但是,当我构建多模块时,从“父”开始,它执行四次,但没有一次过滤属性

听起来像是一个复杂的设置。。。无论如何,您确定
src/main/webapp
的内容不会覆盖过滤后的内容吗?使用
-X
运行maven可能有助于调试正在发生的事情


我的建议是停止滥用Web资源
元素(该元素应用于外部Web资源),并将需要过滤的内容移至
src/main/webapp

之外。为什么要过滤这么多?嗯,项目的需要。。。但它在单机版上可以正常工作,但在模块中不行…为什么要过滤这么多?嗯,项目的需要。。。但它在单机上工作正常,但在模块中不工作。。。