• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Two jars created when using maven-assembly-plugin

 
Marshal
Posts: 3708
523
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using the maven-assembly-plugin plug-in to create an executable fat-jar.  It does work, and AcmeAgent.jar is created and runs as expected.  However acme-agent-0.0.1-SNAPSHOT.jar is also created, and in addition, the following two warnings are displayed:

[WARNING] Configuration option 'appendAssemblyId' is set to false.
Instead of attaching the assembly file: D:\PlatformManager\acme-agent\target\AcmeAgent.jar, it will become the file for main project artifact.
NOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!


[WARNING] Replacing pre-existing project main-artifact file: D:\PlatformManager\acme-agent\target\acme-agent-0.0.1-SNAPSHOT.jar
with assembly file: D:\PlatformManager\acme-agent\target\AcmeAgent.jar

I understand that I am seeing two artifacts because one is created due to the packaging being configured as jar, and the other from the plug-in.  If I change the packaging to be pom, only a single jar is created, and the warnings go away.  Is this the right approach, or should I be resolving this another way?

Any suggestions on how to remove the original artifact after the assembly?

pom.xml
Console:
 
Ron McLeod
Marshal
Posts: 3708
523
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As expected - original artifact also retained using the maven-shade-plugin plug-in.
 
Ron McLeod
Marshal
Posts: 3708
523
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking at this more, I think I was wrong trying to work-around the behaviour of the Maven and the plug-ins by wanting to remove the original jar and replace it with my fat-jar.  A better solution is to create a distribution directory and output the fat-jar and related resources there, leaving the jar built from my code (without the dependencies) alone.

This is what I ended-up doing:
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic