I recently upgraded the maven-source-plugin version in my project from 3.2.1 to 3.3.0 and now I am encountering the following error during the build process:
Failed to execute goal org.apache.maven.plugins:maven-source-plugin:3.3.0:jar (attach-sources) on project xxx: Presumably you have configured maven-source-plugn to execute twice times in your build. You have to configure a classifier for at least on of them. -> [Help 1]
It seems that this error is related to the fact that the maven-source-plugin has changed its behavior in version 3.3.0 to prevent the attach-sources goal from being executed multiple times during the build. However, I can't find any doc or release note related to this feature that may cause this incompatibility problem.
I want to know where I can find the official documentation and what the purpose of this new feature is? Thanks~
Since 3.3.0
the duplicate check will also fails build when multiple lifecycle phase which are bound to the jar-no-fork
goal of the sources plugin are given on the command line. For example
# mvn package install
# mvn install deploy
The solution is to simply avoid the unnecessary lifecycle phase:
# mvn install
# mvn deploy
However, upgrading to maven-sources-plugin
3.3.0 will break quite a number of build I presume.
Had the same issue after upgrading from 3.2.1
to 3.3.0
.
The error was resolved after changing the goal
from jar
to jar-no-fork
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With