子模块中的插件执行方式可能不同

时间:2019-02-08 07:08:05

标签: maven plugins parent-child

我有一个父母pom以及childA和childB。结构如下。

`parent.xml
    -> childA.xml
       -> childA1.xml 
    -> childB.xml`

因此,我在配置文件中定义了插件,该插件将在childA和childB中执行。但是我需要在childA1中使用相同的插件并运行不同的执行。 可能吗?

好的,我在个人pom中拥有此个人资料

<profile>
        <id>sassConversion</id>
            <build>
        <pluginManagement>
                <plugins>
                     <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <version>1.6</version>
                        <inherited>false</inherited>
                        <configuration>
                            <nodeVersion>v10.4.1</nodeVersion>
                        </configuration>
                        <executions>
                            <execution>
                                <id>install node and npm sass</id>
                                <goals>
                                    <goal>install-node-and-npm</goal>
                                </goals>
                                <phase>generate-resources</phase>
                            </execution>
                            <execution>
                                <id>npm install sass</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>install</arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>npm install gulp sass</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>install gulp-sass</arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>gulp run sass</id>
                                <goals>
                                    <goal>gulp</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>sass</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
 </pluginManagement>
            </build>
        </profile>

我正在childA和childB中使用

<profile>
        <id>sassConversion</id>
            <build>
                <plugins>
                     <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                       </plugin>
                </plugins>
            </build>
</profile>

但是在childA1中,我使用的是相同的插件,但是它已从配置文件中覆盖。

<plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <version>1.6</version>
                        <configuration>
                            <nodeVersion>v10.4.1</nodeVersion>
                        </configuration>
                        <executions>
                            <execution>
                                <id>install node and npm</id>
                                <goals>
                                    <goal>install-node-and-npm</goal>
                                </goals>
                                <phase>generate-resources</phase>
                            </execution>
                            <execution>
                                <id>npm install</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>install</arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>npm run build custom elements</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>run build:elements</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>  

父pom的执行在childA1中执行。未执行childA1中定义的执行。

0 个答案:

没有答案
相关问题