4

我的项目有一个父 pom 和几个子模块 pom。我已经在负责构建我们的安装程序分发的父插件中放置了一个插件(使用 install4j)。让这个插件在子模块上运行是没有意义的,所以我在插件的配置中设置了 false,如下所示。问题是,当我运行时mvn clean install install4j:compile <other variables here>,它会在父模块上清理、编译和运行install4j插件,但随后它会尝试在子模块上运行它并崩溃。

这是插件配置

<plugin>
    <groupId>com.google.code.maven-install4j</groupId>
    <artifactId>maven-install4j-plugin</artifactId>
    <version>0.1.1</version>
    <inherited>false</inherited>
    <configuration>
        <executable>${devenv.install4jc}</executable>
        <configFile>${basedir}/newinstaller/ehd-demo.install4j</configFile>
        <releaseId>${project.version}</releaseId>
        <attach>false</attach>
        <skipOnMissingExecutable>true</skipOnMissingExecutable>
    </configuration>
</plugin>

我误解了 的目的inherited=false吗?什么是让它工作的正确方法?

我正在使用 Maven 2.2.0。

4

2 回答 2

2

我发现这可以通过多种方式起作用。我现在的做法...

  1. 拿出来<inherited>false</inherited>
  2. 首轮mvn clean install
  3. 然后运行mvn install4j:compile -N(对于非递归)

插件也可以使用@aggregator注解来达到同样的效果。

于 2010-03-25T18:32:28.260 回答
1

您可以使用激活条件在配置文件中运行插件,但它有点难看:-(

    <profile>
        <id>only-in-root</id>
        <activation>
            <file>
                <exists>this-file-exist-only-in-parent-project.xml</exists>
            </file>
        </activation>
于 2019-10-11T13:40:15.180 回答