Is it possible to rename a maven jar-with-dependencies?
Sure, it's a cinch! Set the <finalName> tag in your pom.xml's <build> section to rename your Maven jar-with-dependencies. For unique identification purposes, add a <classifier> within the maven-assembly-plugin. Here you go:
This gives you a classy AppName-bundle.jar, melding both <finalName> and <classifier>. If you need more granularity, read on.
Getting fancy with assembly descriptor
For a custom assembly descriptor, create a jar-assembly.xml with your specific instructions for the assembly:
Refer to this in your maven-assembly-plugin configuration via the <descriptor> tag. <appendAssemblyId> should be false if you're not keen on adding the assembly id to your jar's name.
Keeping classifier consistency intact
Ensure your classifier stays consistent during installation or deployment to accurately find your artifact:
Tailoring build and region specific profiles
You can manage different build and regional profiles by parameterizing your assembly.xml:
This, along with other advanced configurations, offers some nifty flexibility.
Including the main class and manifest
Keep your jar-with-dependencies fully executable by declaring the main class:
Picking the right dependency scopes
You control the included dependencies via your custom dependencySet:
Exploring output format options
Tailor the archive structure with formats and fileSets for precise customization:
Was this article helpful?