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 Nodet (Jira)" <ji...@apache.org> on 2022/10/14 10:58:00 UTC

[jira] [Commented] (MSHADE-428) Typo causes mysterious NPE in build

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

Guillaume Nodet commented on MSHADE-428:
----------------------------------------

It may be better to enhance maven so that a warning is issue in case an xml attribute / element can not be mapped during the mojo injection.

> Typo causes mysterious NPE in build
> -----------------------------------
>
>                 Key: MSHADE-428
>                 URL: https://issues.apache.org/jira/browse/MSHADE-428
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>            Reporter: Tamas Cservenak
>            Priority: Major
>
> All versions are affected. 
> Has this config for plugin:
> {noformat}
>               <transformers>
>                 <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" />
>                 <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
>                 <transformer implementatioh="org.apache.maven.plugins.shade.resource.SisuIndexResourceTransformer" />
>                 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
>                   <manifestEntries>
>                     <Main-Class>org.apache.maven.index.cli.NexusIndexerCli</Main-Class>
>                     <Multi-Release>true</Multi-Release>
>                   </manifestEntries>
>                 </transformer>
>               </transformers> {noformat}
> And build was failing with 
> {noformat}
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.4.0:shade (default) on project indexer-cli: Error creating shaded jar: Problem shading JAR /home/cstamas/Worx/apache-maven/maven-indexer/indexer-cli/target/indexer-cli-7.0.0-SNAPSHOT.jar entry META-INF/sisu/javax.inject.Named: java.lang.NullPointerException -> [Help 1] {noformat}
> Cause: there is a typo in config, notive {{implementatioH}} for sisu transformer.
> This caused that list of transformes had a null element, and seems there is no validation that transformers list may not have null element. NPE happened when default shared method {{private boolean resourceTransformed(}} stepped onto null element and had {{null.canTransformResource( name )}}.



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