Reputation: 25
I'm trying to add the maven-shade-plugin to my pom but every time I put it with the configuration into the pluginManagement
with the other plugins it can't be found in my plugins after reloading the pom.
After also adding the plugin without the config outside & after the pluginManagement
it works but I get another Error. Now the outside plugin isn't found!
Here is a little snippet of my POM:
<build>
<pluginManagement>
<plugins>
<!-- other plugins -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<id>first_build</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<Main-Class>classpath.to.class</Main-Class>
</transformer>
</transformers>
<finalName>NameOfCreatedJAR</finalName>
</configuration>
</execution>
<execution>
<id>second_build</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<Main-Class>classpath.to.class</Main-Class>
</transformer>
</transformers>
<finalName>NameOfCreatedJAR</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<!-- artifactId can't be found -->
<artifactId>maven-shade-plugin</artifactId>
</plugin>
</plugins>
</build>
I would really appreciate it if someone could tell me what I am doing wrong!
Thx in advance :)
Upvotes: 1
Views: 6131
Reputation: 29
I am from China, and my english is poor··· I was in same problem, but now I have solved it. I will share the way of my solution. The problem is that the maven cannot find the plugin from our repository, so we can find the plugin in our repository(you can search the plugin in your native repository and find the version that is cannot be found), then find and choose an existing plugin to use. If it cannot solve the problem can you delete the plugin and reload it again.
Upvotes: 1