1
votes

My issue is that the maven-shade-plugin seems to be running on my project twice.

My parent-pom file is here: http://pastebin.com/EsYaCbzJ (It is way too long to post here)

The pom for the project (well, module in this case) giving me trouble is here: http://pastebin.com/jdyGXGpL

I am attempting to shade in the MySQL jdbc driver.

Here is the block from the pom.xml that I wish to do that with.

<build>
....
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.4.3</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <shadedArtifactAttached>true</shadedArtifactAttached>
          <createDependencyReducedPom>false</createDependencyReducedPom>
          <relocations>
            <relocation>
              <pattern>mysql</pattern>
              <shadedPattern>mysql.shaded</shadedPattern>
            </relocation>
          </relocations>
          <artifactSet>
            <excludes>
              <exclude>com.fakeneth.mydynamicsql:mydynamicsql-core</exclude>
              <exclude>junit:junit</exclude>
            </excludes>
          </artifactSet>
        </configuration>
      </execution>
    </executions>
  </plugin> 
...
</build>

Now, the issue occurs (or seems to occur) when I try to build the project. I build it using nothing different than what is seen in both pom.xml's.

For some reason, the following lines are displayed twice, a little bit after eachother;

[INFO] --- maven-shade-plugin:2.4.3:shade (default) @ mydynamicsql-standalone ---

[INFO] Excluding com.fakeneth.mydynamicsql:mydynamicsql-core:jar:0.0.1-SNAPSHOT from the shaded jar.

[INFO] Including mysql:mysql-connector-java:jar:5.1.38 in the shaded jar.

[INFO] Attaching shaded artifact.

The following line is also displayed twice, in succession;

[INFO] Installing C:\Users\cneth_000\Documents\EclipseWorkspace\mydynamicsql-parent\mydynamicsql-standalone\target\mydynamicsql-standalone-0.0.1-SNAPSHOT-shaded.jar to C:\Users\cneth_000\.m2\repository\com\fakeneth\mydynamicsql\mydynamicsql-standalone\0.0.1-SNAPSHOT\mydynamicsql-standalone-0.0.1-SNAPSHOT-shaded.jar

Here is a full log of what is printed when this project is built: http://pastebin.com/L3RQaUvv

Is this the expected behavior? Thanks

1
The maven-jar-plugin is running twice and it looks wrongly configured cause it produces an artifact without an version and i assume there something else configured.khmarbaise
@khmarbaise I don't know if that is the issue. How could I have wrongly configure it when all I have added was <packaging>jar</packaging> ?C_Neth
May be based on a parent pom?khmarbaise
@khmarbaise The parent pom doesn't have anything different besides a "pom" packaging style for the most part. That and the compiler plugin is all that is differentC_Neth
Please show the full pom and not only excerpts otherwise it is impossible to helpkhmarbaise

1 Answers

0
votes

I solved my issue.

When I was building my project, I was building my parent project. It turns out that by building each module individually will not cause ALL of my plugins to execute twice. For some reason, building the parent project caused each module to be built twice.