相关疑难解决方法(0)

按组合而不是继承导入maven插件配置.可以使用构建扩展来完成吗?

按组合而不是继承导入maven插件配置.可以使用构建扩展来完成吗?

我已经使用maven超过3年了,并且有一个总是困扰我的缺点.是时候找到解决方案了.

问题:

我有一个带有3个孩子的"爸爸"maven模块:"男孩","女孩"和"孩子".这些孩子中的每一个都必须拥有自己独特的一组插件配置,用于默认的"干净安装"构建.我不想把这个配置放在孩子们的poms上.我宁愿把它放在我以后可以重复使用的地方.

我已尝试使用配置文件,但它不起作用 - 请在MNG-5127上查看我的评论和附加项目

我通过对daddy.zip项目进行以下更改找到了更好的解决方案:

1)在爸爸的pom上,用[phase] none [/ phase]的插件执行替换[profiles]

<build>
    ...
    <plugins>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <id>printboy</id>
                    <phase>none</phase>
                    <configuration>
                        <target>
                            <echo message="@@@@@@@@@@@@ HELLO! Iam a BOY project"/>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
                <execution>
                    <id>printkid</id>
                    <phase>none</phase>
                    <configuration>
                        <target>
                            <echo message="@@@@@@@@@@@@ HELLO! Iam a KID project"/>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
                <execution>
                    <id>printgirl</id>
                    <phase>none</phase>
                    <configuration>
                        <target>
                            <echo message="@@@@@@@@@@@@ HELLO! Iam a GIRL project"/>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    ... …
Run Code Online (Sandbox Code Playgroud)

java maven-plugin maven maven-extension

13
推荐指数
1
解决办法
6509
查看次数

标签 统计

java ×1

maven ×1

maven-extension ×1

maven-plugin ×1