[Created] (MNG-6764) Maven sources plugin uses configuration different than expected

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Created] (MNG-6764) Maven sources plugin uses configuration different than expected

Sylwester Lachiewicz (Jira)
Adrian Wyssmann created MNG-6764:
------------------------------------

             Summary: Maven sources plugin uses configuration different than expected
                 Key: MNG-6764
                 URL: https://issues.apache.org/jira/browse/MNG-6764
             Project: Maven
          Issue Type: Bug
         Environment: Maven 3.5.4
            Reporter: Adrian Wyssmann


While debugging the problem described [here|https://stackoverflow.com/questions/4251488/maven-release-plugin-fails-source-artifacts-getting-deployed-twice], I've noticed something strange.

I have a project which has the following config for the "maven-source-plugin"
{code:java}
...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <attach>true</attach>
                </configuration>
            </plugin>
{code}
and the this in the parent-pom
{code:java}
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.1.0</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
{code}
As the sources-jar is uploaded twice the build fails, thus I checked the "effective pom" by running
{code:java}
mvn -Prelease-profile help:effective-pom
{code}
The result is strange as the configuration for the maven-source-plugin is something totally different. Once under "pluginManagement"
{code:java}
    <build>
        ...
        <pluginManagement>
           ...
           <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
            ...
        </pluginManagement>
{code}
and once under "plugins"
{code:java}
    <build>
        ...
        </pluginManagement>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
                <execution>
                <id>attach-sources</id>
                <goals>
                    <goal>jar-no-fork</goal>
                    <goal>jar</goal>
                </goals>
                <configuration>
                    <attach>true</attach>
                </configuration>
                </execution>
            </executions>
{code}
I don't understand how this is possible and where the config comes from. Is this a bug? Something I miss?

 



--
This message was sent by Atlassian Jira
(v8.3.2#803003)