Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8082935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:17:15+00:00 2026-06-05T17:17:15+00:00

I am using maven-shade-plugin for a simple maven project, the plugin successfully includes all

  • 0

I am using maven-shade-plugin for a simple maven project, the plugin successfully includes all the dependencies into a final “shaded” jar. The process works well every time and produces exactly what I need.

When run the “first” time (after a clean), the plugin is quiet and produces very little output. However, when re-run (without a clean from the last build), there are lots of warning messages such as this;

[WARNING] We have a duplicate package/a/b/foo.class
[WARNING] We have a duplicate package/c/d/bar.class

This are warning messages only and the final artifact works fine.

My question is simple: how can I safely workaround or suppress these warning messages without having to run a clean first?


note: A possible solution would be to move to the maven-assembly-plugin, but I would prefer not to because the configuration for maven-shade-plugin is very nice and simple.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:17:17+00:00Added an answer on June 5, 2026 at 5:17 pm

    This is because it is shading the files into an already shaded jar.

    The first time you run package after a clean then it will create the jar.
    The second time you run it then it doesn’t bother as the jar already exists.

    From the shade plugins perspective it doesn’t know that this has already been shaded so it just tries to add the classes again.

    We can force maven to create the jar everytime by configuring the jar plugin:

    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-jar-plugin</artifactId>
       <version>2.4</version>
       <configuration>
         <forceCreation>true</forceCreation>
       </configuration>
    </plugin>
    

    And this works for me. Either that or just do a clean install

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the Maven-Shade-Plugin to create a runnable Uber-jar. According to the last
I'm using the shade Maven2 plugin to build a monolithic JAR with all Java
I am using Maven in Eclipse to manage the project dependencies which are resolved
I'm using maven to build a .ear project that resolves dependencies from a maven
Spring 3.1.1.RELEASE with Apache Maven 3.0.3 and Maven Shade plugin 1.6. Using the mvn
I am using maven-buildnumber-plugin version 1.0-beta-4. This works fine on a project checked out
I'm having maven project on Eclipse with m2eclipse plugin. This project has some dependencies.
Using Maven war plugin, I generate WAR which includes following directory: META-INF -- maven
Im using maven to build a multi module project. But some projects are in
I am using maven to generate a website for a Java project, which uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.