maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Ernst <johannes.er...@gmail.com>
Subject [WARNING] Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing.
Date Sun, 10 May 2015 00:03:27 GMT
A couple of days I asked about how to “roll up” several maven projects into a new one,
as if the old ones had never existed. Didn’t get a reply though.

Reviewing the source code for AbstractAssemblyMojo, I found that if I set

    appendAssemblyId=false

(default is true, and this @Parameter does not seem to be documented on the website), I get
the behavior I want.

Plus the above warning. Here it is in its full glory:

    [WARNING] Configuration options: 'appendAssemblyId' is set to false, and 'classifier'
is missing.
    Instead of attaching the assembly file: xxx.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!

Which in my case, is entirely unnecessary because I only have one. And I think my use of the
plugin is useful :-)

Can I suggest the following modification of the code, in AbstractAssemblyMojo.execute()

    <strike> boolean warnedAboutMainProjectArtifact = false;
    <insert> int numberMainArtifactReplacers = 0;

    for ( final Assembly assembly : assemblies )
    {
        …
        for ( final String format : effectiveFormats )
            …
            … (long if-then-else)
            else if ( !"pom".equals( type ) && format.equals( type ) )
            {
                <strike> if ( !warnedAboutMainProjectArtifact )
                <insert> if( numberMainArtifactReplacers > 1 ) 
                {
                    … emit above warning

                    <strike>warnedAboutMainProjectArtifact = true;
                    <insert>++ numberMainArtifactReplacers;

and perhaps, upgrade the warning to an error because it now only gets emitted if there indeed
will be a conflict.

And some documentation on the website that says this can be done.

Now, shoot, and tell me what this is a bad idea! :-) 

Cheers,



Johannes.


Johannes Ernst
Blog: http://upon2020.com/ <http://upon2020.com/>
Twitter: @Johannes_Ernst
GPG key: http://upon2020.com/public/pubkey.txt <http://upon2020.com/public/pubkey.txt>
Check out UBOS, the Linux distro for personal servers: http://ubos.net/ <http://ubos.net/>



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message