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 7678019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:32:59+00:00 2026-05-31T17:32:59+00:00

I am using the Maven-Shade-Plugin to create a runnable Uber-jar. According to the last

  • 0

I am using the Maven-Shade-Plugin to create a runnable Uber-jar.
According to the last frame on this page, the size of the jar can be minimized by using:

<configuration>
      <minimizeJar>true</minimizeJar>
</configuration>

But this feature does not take into consideration the classes that are declared in the log4j.properties file. Hence, e.g. org.apache.log4j.appender.TimeAndSizeRollingAppender is not included in the Uber-jar, even though it’s declared in the log4j.properties file.

I believe I will face the same problem with Spring. If my code only refers to interface A and my Spring file contains an instantiation of class B that implements A, then B might not be added to the jar, since it’s not in the code.

How can I solve this problem?

  • 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-05-31T17:33:00+00:00Added an answer on May 31, 2026 at 5:33 pm

    This functionality has been added to version 1.6 of the maven-shade-plugin (just released). minimizeJar will now not remove classes that have been specifically included with filters. Note that including some of an artifact’s classes in a filter will exclude non-specified classes for that artifact, so be sure to include all the classes that you need.

    Here’s an example plugin config:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>1.6</version>    
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>shade</goal>
                </goals>                        
                <configuration>
                    <minimizeJar>true</minimizeJar>    
                    <filters> 
                        <filter>
                           <artifact>log4j:log4j</artifact>
                           <includes>
                               <include>**</include>
                           </includes>
                        </filter> 
                        <filter>
                           <artifact>commons-logging:commons-logging</artifact>
                           <includes>
                               <include>**</include>
                           </includes>
                        </filter>                      
                    </filters>
                </configuration>
            </execution>
        </executions>
    </plugin>
    

    To only include specific classes, add them as includes using path slashes in the class name in a filter (again, non-included classes will be automatically excluded).

    <filter>
      <artifact>org.yourorg:your-artifact</artifact>
      <includes>
        <include>org/yourorg/yourartifact/api/*</include>
        <include>org/yourorg/yourartifact/util/*</include>
      </includes>
    </filter>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using maven-buildnumber-plugin version 1.0-beta-4. This works fine on a project checked out
I'm using the shade Maven2 plugin to build a monolithic JAR with all Java
I have a scenario where-in I need to create an uber jar of a
I'm using Maven with the Assembly plugin and would like to set the user
I'm using Maven 3.0.3. For our project integration testing, we require a virtual frame
I'm thinking of using IntelliJ+Maven+GWT. I'd like to create/build project using maven and do
I'm using Maven 3.0.3 on Mac 10.6.6. I have a JAR project and when
I have application launched using maven cargo plugin with jetty6x. I get HTTP/1.1 413
I am using maven weblogic plugin 10.3.4. I have read the goal list of
using maven, what does the wtpversion mean in the Eclipse plugin?

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.