maven使用带有iterator-maven-plugin

时间:2018-09-14 22:20:02

标签: maven pom.xml maven-profiles

我有一个pom.xml文件包含多个<profile>,当我使用mvn clean install -P dev,stage时,它仅在${basedir}/target/filters/下生成 filter-stage 过滤文件,有人可以告诉我为什么它没有在文件夹下生成 filter-dev 过滤器文件吗?

代码显示如下:

<profiles>
        <profile>
            <id>dev</id>
            <build>             
                <plugins>
                    <plugin>
                        <groupId>com.soebes.maven.plugins</groupId>
                        <artifactId>iterator-maven-plugin</artifactId>
                        <version>0.3</version>
                        <executions>
                            <execution>
                                <phase>install</phase>
                                <goals>
                                    <goal>iterator</goal>
                                </goals>
                                <configuration>                                 
                                    <items>
                                        <item>abc</item>
                                        <item>access</item>                                     
                                    </items>

                                    <pluginExecutors>
                                        <pluginExecutor>
                                            <plugin>
                                                <groupId>org.apache.maven.plugins</groupId>
                                                <artifactId>maven-resources-plugin</artifactId>
                                                <version>2.7</version>
                                            </plugin>
                                            <goal>resources</goal>
                                            <configuration>
                                                <outputDirectory>${basedir}/target/</outputDirectory>
                                                <filters>
                                                    <filter>src/main/resources/filters/filter-fi-environment/dev/filter-dev-@item@-wf.properties</filter>
                                                </filters>
                                            </configuration>
                                        </pluginExecutor>
                                        <pluginExecutor>
                                            <plugin>
                                                <groupId>org.apache.maven.plugins</groupId>
                                                <artifactId>maven-antrun-plugin</artifactId>
                                                <version>1.7</version>
                                            </plugin>
                                            <goal>run</goal>
                                            <configuration>
                                                <target name="rename_file">
                                                    <move
                                                            file="${basedir}/target/filters/filter-template-wf.properties"
                                                            tofile="${basedir}/target/filters/filter-dev-${item}-wf.properties" />
                                                </target>
                                            </configuration>
                                        </pluginExecutor>
                                    </pluginExecutors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.5.3</version>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/package.xml</descriptor>
                            </descriptors>
                            <appendAssemblyId>false</appendAssemblyId>
                            <finalName>batch-workflow</finalName>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>install</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>2.3.2</version>
                        <configuration>
                            <source>1.7</source>
                            <target>1.7</target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>stage</id>
            <build>             
                <plugins>
                    <plugin>
                        <groupId>com.soebes.maven.plugins</groupId>
                        <artifactId>iterator-maven-plugin</artifactId>
                        <version>0.3</version>
                        <executions>
                            <execution>
                                <phase>install</phase>
                                <goals>
                                    <goal>iterator</goal>
                                </goals>
                                <configuration>                                 
                                    <items>
                                        <item>abc</item>
                                        <item>access</item>                                     
                                    </items>

                                    <pluginExecutors>
                                        <pluginExecutor>
                                            <plugin>
                                                <groupId>org.apache.maven.plugins</groupId>
                                                <artifactId>maven-resources-plugin</artifactId>
                                                <version>2.7</version>
                                            </plugin>
                                            <goal>resources</goal>
                                            <configuration>
                                                <outputDirectory>${basedir}/target/</outputDirectory>
                                                <filters>
                                                    <filter>src/main/resources/filters/filter-fi-environment/stage/filter-stage-@item@-wf.properties</filter>
                                                </filters>
                                            </configuration>
                                        </pluginExecutor>
                                        <pluginExecutor>
                                            <plugin>
                                                <groupId>org.apache.maven.plugins</groupId>
                                                <artifactId>maven-antrun-plugin</artifactId>
                                                <version>1.7</version>
                                            </plugin>
                                            <goal>run</goal>
                                            <configuration>
                                                <target name="rename_file">
                                                    <move
                                                            file="${basedir}/target/filters/filter-template-wf.properties"
                                                            tofile="${basedir}/target/filters/filter-stage-${item}-wf.properties" />
                                                </target>
                                            </configuration>
                                        </pluginExecutor>
                                    </pluginExecutors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.5.3</version>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/package.xml</descriptor>
                            </descriptors>
                            <appendAssemblyId>false</appendAssemblyId>
                            <finalName>batch-workflow</finalName>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>install</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>2.3.2</version>
                        <configuration>
                            <source>1.7</source>
                            <target>1.7</target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
</profiles>     

0 个答案:

没有答案