Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Two jars created when using maven-assembly-plugin

 
Sheriff
Posts: 3123
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 3123
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As expected - original artifact also retained using the maven-shade-plugin plug-in.
 
Ron McLeod
Sheriff
Posts: 3123
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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:
 
bacon. tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic