You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Guillaume Boué (JIRA)" <ji...@apache.org> on 2016/07/21 15:58:20 UTC

[jira] [Commented] (MASSEMBLY-824) Use of appendAssemblyId and finalName can cause problems

    [ https://issues.apache.org/jira/browse/MASSEMBLY-824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15387942#comment-15387942 ] 

Guillaume Boué commented on MASSEMBLY-824:
------------------------------------------

I am not sure what the actual problem is. The local files under {{target}} at the end of the build are just that, local files. What the end users are going to see are what is getting deployed / released, not those local files. I'm not sure we want to provide more fine-grained control on the name of the local generated file (in Maven Jar plugin, the {{finalName}} was even made read-only: [MJAR-217|https://issues.apache.org/jira/browse/MJAR-217]).

bq. Make it clear in the {{appendAssemblyId}} option, that this affects both the local and the installed artifact's file name.

This is documented in the id element of the descriptor format http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_assembly

bq. Also clarify the warning that appears when this option is set to false.

The warning already says it. It starts with "'appendAssemblyId' is set to false""

bq. Also, maybe suggest to set {{attach}} to false if a conflict is detected?

The warning could suggest that, although I suspect the majority of assembly artifacts need to be attached. Don't have an opinion on that one.

bq. Make it clear in the {{finalName}} option, that this only affects the local file name and NOT the installed artifact's file name.

This is not specific to the Assembly Plugin and is a Maven consideration. The local file name is never considered, [only the GAVC make up for the coordinates|https://maven.apache.org/pom.html#Maven_Coordinates] used in repositories.

> Use of appendAssemblyId and finalName can cause problems
> --------------------------------------------------------
>
>                 Key: MASSEMBLY-824
>                 URL: https://issues.apache.org/jira/browse/MASSEMBLY-824
>             Project: Maven Assembly Plugin
>          Issue Type: Bug
>    Affects Versions: 2.6
>            Reporter: Sebastian Geiger
>
> I recently had a usecase where I wanted to rename an artifact locally in the target/ folder. I configured the maven-assembly-plugin with the following options:
> {code}
> <appendAssemblyId>false</appendAssemblyId>
> <finalName>helper-${project.version}</finalName>
> {code}
> As expected the resulting name was `helper-5.0.0-SNAPSHOT.jar`.
> Next when I built the project I noticed warnings about a conflict with the default artifact for the project.
> {quote}
>     [WARNING] Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing. Instead of attaching the assembly file: [...]/target/helper-5.0.0-SNAPSHOT.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: [...]/target/my.module-5.0.0-SNAPSHOT.jar with assembly file: [...]/target/helper-5.0.0-SNAPSHOT.jar
> {quote}
> Irritated by these warnings I asked about this on [StackOverflow|http://stackoverflow.com/questions/38482839/maven-assembly-plugin-how-to-use-appendassemblyid/38484021#38484021] and received the following explanation:
> Essentially during installation the standard maven coordinates (G-A-V-C) are still used independent of the {{finalName}} used to for the artifact, since this only affects the local name inside the {{target}} folder. Now, when the {{appendAssemblyId}} is set to {{false}} the classifier will be dropped not only from the local name, but also from the artifact's name used during installation and there will be a clash with the default artifact name if the project's packaging is set to jar.
> Currently there seem to be only two solutions:
> # Do not set the {{appendAssemblyId}} option to {{false}}, which means that the local name used inside the target folder will still get the assemblyId appended (e.g. <finalName>-jar-with-dependencies.jar).
> # Alternatively, set the option {{attach}} to {{false}}, this will avoid the above mentioned warning but also means that the artifact will no longer be installed.
> Of course I could just ignore he warning, but the after all the warning has a reason and I would rather fix that then ignore the warning.
> h1. Suggested solutions:
> IMHO there are several solutions to resolve this:
> # Omit the assemblyId on the local name by default if {{finalName}} is used. Additionally change the semantics of the {{appendAssemblyId}} option to only affect the installed artifact's name.
> # Add an additional option to control if the assemblyId is appended to the local file name.
> In any case, also if none of the suggested options are feasible I suggest to document this better.
> * Make it clear in the {{appendAssemblyId}} option, that this affects both the local and the installed artifact's file name. Also clarify the warning that appears when this option is set to false. Also, maybe suggest to set {{attach}} to {{false}} if a conflict is detected?
> * Make it clear in the {{finalName}} option, that this only affects the local file name and NOT the installed artifact's file name.
> Thank you for your time and attention.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)