Skip to content

Fix duplicate maven-source-plugin execution in docker-snapshot profile#173

Merged
jwijgerd merged 2 commits into
mainfrom
copilot/fix-duplicate-artifacts-error
Nov 16, 2025
Merged

Fix duplicate maven-source-plugin execution in docker-snapshot profile#173
jwijgerd merged 2 commits into
mainfrom
copilot/fix-duplicate-artifacts-error

Conversation

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown
Contributor

The docker-snapshot workflow failed with "We have duplicated artifacts attached" when running mvn install spring-boot:build-image. The spring-boot:build-image goal internally triggers the package phase, causing maven-source-plugin to execute twice—once during install and again during the re-executed package phase.

Changes

  • Disabled maven-source-plugin execution in the docker-snapshot profile by setting phase to none
  • Source JARs are unnecessary for Docker image builds and only needed for Maven artifact deployment
<profile>
    <id>docker-snapshot</id>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-source</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</profile>

Regular builds and other profiles remain unaffected—source JARs are still generated for Maven deployments.

Original prompt

On maven.yml, when the docker-snapshot workflow is run we get this error:

[INFO] --- source:3.3.1:jar-no-fork (attach-source) @ akces-operator ---
[INFO] Building jar: /home/runner/work/akces-framework/akces-framework/services/operator/target/akces-operator-0.11.0-SNAPSHOT-sources.jar
Error: We have duplicated artifacts attached.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Elastic Software Foundation :: Akces :: Services 0.11.0-SNAPSHOT:
[INFO]
[INFO] Elastic Software Foundation :: Akces :: Services ... SUCCESS [ 1.418 s]
[INFO] Elastic Software Foundation :: Akces :: Services :: Akces Operator FAILURE [ 3.895 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.755 s
[INFO] Finished at: 2025-11-16T15:26:03Z
[INFO] ------------------------------------------------------------------------
Error: Failed to execute goal org.apache.maven.plugins:maven-source-plugin:3.3.1:jar-no-fork (attach-source) on project akces-operator: Presumably you have configured maven-source-plugin to execute twice in your build. You have to configure a classifier for at least one of them. -> [Help 1]
Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: Re-run Maven using the -X switch to enable full debug logging.
Error:
Error: For more information about the errors and possible solutions, please read the following articles:
Error: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Error:
Error: After correcting the problems, you can resume the build with the command
Error: mvn -rf :akces-operator
Error: Process completed with exit code 1.

can you figure out what's wrong?


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix duplicate artifacts error in docker-snapshot workflow Fix duplicate maven-source-plugin execution in docker-snapshot profile Nov 16, 2025
Copilot AI requested a review from jwijgerd November 16, 2025 15:43
@jwijgerd
jwijgerd marked this pull request as ready for review November 16, 2025 15:43
@jwijgerd
jwijgerd merged commit ecbc9e2 into main Nov 16, 2025
1 check passed
@jwijgerd
jwijgerd deleted the copilot/fix-duplicate-artifacts-error branch November 16, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants