apache / apache/maven-assembly-plugin

[MASSEMBLY-993] Configuration option to specify artifact classifier.

Open
#1,203 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
110
Forks
75
Avg merge
12h 54m
Merged PRs (30d)
10

Description

**[Garret Wilson](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=garretwilson)** opened **[MASSEMBLY-993](https://issues.apache.org/jira/browse/MASSEMBLY-993?redirect=false)** and commented

Please add a `classifier` option to the Maven Assembly Plugin, similar to the [Spring Boot Maven Plugin option of the same name](https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#goals-repackage-parameters-details-classifier), to allow a POM to explicitly indicate what classifier to append to the end of the artifact.

Generated Maven artifacts have an option of a "classifier" such as `javadoc` or `sources`. This is placed on the end of a artifact base filename, such as `foo-1.2.3-javadoc.jar` or `foo-1.2.3-sources`. See the description of classifiers in the [Maven POM Reference](https://maven.apache.org/pom.html) for more details.

The Spring Boot Maven Plugin has a simple [configuration to set the classifier](https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#goals-repackage-parameters-details-classifier). Thus if I specify `bar` as my classifier, then Spring Boot Maven Plugin generates `foo-1.2.3-bar.jar`.

The Maven Assembly Plugin's only equivalent facility is indirect and arguably semantically incorrect. Instead of specifying a "classifier", the Assembly Plugin has a Boolean option to [append the assembly ID](https://maven.apache.org/plugins/maven-assembly-plugin/single-mojo.html#appendAssemblyId). The name of this option is a little unclear; what it's really saying is "use the assembly ID as the artifact classifier". Using the assembly ID as the classifier is not a bad default, but the problem is not allowing an option for an alternate classifier.

The drawback here is that the consumer of a public, published assembly descriptor _has no control over what the ID is defined within the descriptor_. There needs to be a way to specify the generated artifact classifier _at the point of plugin definition_, independent of what is defined in the descriptor. (Of course, if MASSEMBLY-992 were implemented, this would provide one workaround, although not solve the problem of consuming published artifact descriptors.)

As an example see https://github.com/symphoniacloud/lambda-packaging/issues/1 . Symphonia publishes a Maven Assembly Plugin descriptor, but the ID it uses (for reasons I outline in that ticket) is less than ideal. If the Assembly Plugin simply were to allow a `classifier` option like Spring Boot Maven Plugin does, the POM could simply choose whatever it wants, independent of the ID in the assembly descriptor.

---
No further details from [MASSEMBLY-993](https://issues.apache.org/jira/browse/MASSEMBLY-993?redirect=false)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Maven Assembly Plugin configuration for appendAssemblyId and the artifact naming behavior it controls. Trace how the assembly descriptor ID becomes the classifier, then determine where a plugin-level classifier option belongs. Done means a POM can choose a classifier independently of the descriptor ID while existing appendAssemblyId behavior remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.