0

I'm probably missing some conceptual point here, but I want to define a plugin in the pluginManagement's parent pom (skip = true), then in the child pom I wanna define a profile to enable this plugin and override just part of the configuration section (<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>

The error I'm facing it that deploy process cannot find a file called "none" (the value defined on parent's, since the child's <file> "override" is not working).

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

What am I missing here?

  • Needs a complete log. You have not demonstrated that (1) the error is coming from the child module (2) or that `deploy-module-zip` is active. – chrylis -cautiouslyoptimistic- Aug 20 '20 at 07:51
  • Does this answer your question? [Is it possible to override the configuration of a plugin already defined for a profile in a parent POM?](https://stackoverflow.com/questions/1771561/is-it-possible-to-override-the-configuration-of-a-plugin-already-defined-for-a-p) – Smutje Aug 20 '20 at 07:54
  • @chrylis-cautiouslyoptimistic- logs added, and I'm activating this profile with -Pdeploy-module-zip, otherwise the plugin that is disabled on parent would not be triggered. – VeryNiceArgumentException Aug 20 '20 at 09:10
  • @Smutje - That post doesn't have an accepted answer, but I got from that the combine.self="override" attribute. Unfortunately it hasn't make any difference. – VeryNiceArgumentException Aug 20 '20 at 09:16
  • `on project module-parent`: It appears to be _during running deploy on the parent_ that you're getting the failure. – chrylis -cautiouslyoptimistic- Aug 20 '20 at 15:37

0 Answers0