Maven-子pom会覆盖父项的插件属性

问题描述

我可能在这里缺少一些概念性要点,但是我想在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>

module-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

我在这里想念什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...