You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Garret Wilson (Jira)" <ji...@apache.org> on 2023/07/04 00:57:00 UTC

[jira] [Created] (MASSEMBLY-993) Configuration option to specify artifact classifier.

Garret Wilson created MASSEMBLY-993:
---------------------------------------

             Summary: Configuration option to specify artifact classifier.
                 Key: MASSEMBLY-993
                 URL: https://issues.apache.org/jira/browse/MASSEMBLY-993
             Project: Maven Assembly Plugin
          Issue Type: Improvement
            Reporter: Garret Wilson


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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)