6

I have a maven project generating a jar and not appending maven-assembly-plugin's appendAssemblyId.

How can I get maven to stop issuing the warning: "Configuration option 'appendAssemblyId' is set to false." ?

EDIT: I was asked to include the pom file, which I'm not permitted to do. I'm including the maven-assembly-plugin block which causes the error.

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <configuration>
    <archive>
      <manifest>
        <mainClass>some.company.hello</mainClass>
      </manifest>
    </archive>
    <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    <!-- prevent appending <descriptorRef> "jar-with-dependencies" to final jar name -->
    <appendAssemblyId>false</appendAssemblyId>
  </configuration>
  <executions>
    <execution>
      <!-- For inheritance merges -->
      <id>make-assembly</id>
      <!-- bind to the packaging phase -->
      <phase>package</phase> 
      <goals>
        <goal>single</goal>
      </goals>
    </execution>
  </executions>
</plugin>    
garyM
  • 802
  • 2
  • 12
  • 29
  • Please show your pom file? – khmarbaise Feb 08 '19 at 08:31
  • This is simple not your pom file. This is only the maven-assembly-plugin configuration part...does not help here...You can of course add the pom file where groupId/artifactId etc. are replaced with "XX" etc. The question is why you have defined the `false` which does usually not makes sense.. ? – khmarbaise Feb 08 '19 at 20:31
  • 1
    @ khmarbaise Thanks for your help..false "is" the source of the warning. Removing the tag or changing the value from "false" to "true" negates the warning, but appends "jar-with-dependencies" to the jar. I was hoping someone has already solved this issue. I may have to look at the sources find if it's possible to suppress warnings. I used maven-assembly-plugin due to other warning from shade. I'd write a suppress warning plugin if someone else could maintain it. – garyM Feb 08 '19 at 23:21
  • This is not an issue it's intentional to have this warning if you have set it to false. If you are using maven-shade-plugin you don't need to use maven-assembly-plugin...the question is: what kind of warnings did you had there ? A suppress warning plugin is simply the wrong way cause you seemed to misunderstand some of the use cases and intentions of the plugins ... – khmarbaise Feb 10 '19 at 10:01
  • 2
    @ khmarbaise... as said previously I moved away from maven-shade-plugin and used maven-assembly-plugin instead. "A suppress warning plugin is simply the wrong way cause you seemed to misunderstand some of the use cases and intentions of the plugins" I fully understand the use cases and intention of the plugin, I just don't like the warning and frankly find it insulting. If I chose to remove the assembly-id, I know I'm doing it and don't need to be second guessed. – garyM Feb 11 '19 at 11:06
  • It is a reasonable requirement to create the final jar file that you can specify the name, in this case without the '-jar-with-dependencies' part. It is an old question now. I hope somebody have found a proper way to do this. – zhouji Jan 18 '21 at 18:44

1 Answers1

1

This answer explains the technical details, but I think the key is the phrase that you mentioned in your question.

I have a maven project generating a jar and not appending maven-assembly-plugin's appendAssemblyId.

If I'm understanding correctly, I take this to mean that in your pom file, you have an entry that says

    <packaging>jar</packaging>

What this does is create a jar file that competes with the output of the maven-assembly-plugin, and maven-assembly-plugin wins out, resulting in only one jar file. In fact, if you were to set appendAssemblyId back to true, you will get two files in the output directory - <artifact>.jar and <artifact>-jar-with-dependencies.jar.

So, first, you should remove the <packaging> tag I mentioned above, and add the following to the <executions> section of your pom file so that there won't be two conflicting/competing jar files (and the warning will go away):

<execution>
    <id>default-jar</id>
    <phase>none</phase>
</execution>
éclairevoyant
  • 392
  • 2
  • 15