maven-child pom重写父级的plugin属性

70gysomp  于 2021-07-09  发布在  Java
关注(0)|答案(0)|浏览(289)

我可能在这里遗漏了一些概念性的要点,但是我想在pluginmanagement的父pom(skip=true)中定义一个插件,然后在子pom中定义一个概要文件来启用这个插件并覆盖部分配置部分( <file> ).
pom.xml文件

<pluginManagement>
    <plugins>
        <plugin>
            <artifactId>maven-deploy-plugin</artifactId>
            <configuration>
                <skip>true</skip>
            </configuration>
            <executions>
                <execution>
                    <id>deploy-file</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy-file</goal>
                    </goals>
                    <configuration>
                        <file>none</file>
                        <repositoryId>${project.distributionManagement.snapshotRepository.id}</repositoryId>
                        <url>${project.distributionManagement.snapshotRepository.url}</url>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>${project.artifactId}</artifactId>
                        <version>${project.version}</version>
                        <packaging>zip</packaging>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</pluginManagement>

模块a/pom.xml

<profiles>
    <profile>
        <id>deploy-module-zip</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <configuration>
                        <skip>false</skip>
                    </configuration>
                    <executions>
                        <execution>
                            <id>deploy-file</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>deploy-file</goal>
                            </goals>
                            <configuration>
                                <file>module-a/target/module-a.zip</file>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

我面临的错误是部署进程找不到名为“none”的文件(父进程上定义的值,因为子进程 <file> “覆盖”不起作用)。

Step 4/4: Deploy snapshot (Maven) (6s)
[09:31:12][Step 4/4] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (deploy-file) on project module-parent: /sbclocal/localstorage/teamcity/agent_02/work/cff9a122f8eb31a3/none not found.
[09:31:14][Step 4/4] Process exited with code 1 (Step: Deploy snapshot (Maven))
[09:31:14][Step 4/4] Step Deploy snapshot (Maven) failed

我错过了什么?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题