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

Evgeniy Latukhin edited comment on MPH-135 at 3/17/18 12:26 PM:
----------------------------------------------------------------

I am too impacted by this issue. As far as i can debug this one is related to 
the "null" encoding formed in effective pom output.

As a result effective pom looks 'fine' when outputed to console but breaks on 
 org.codehaus.plexus.util.xml.XmlStreamWriter#detectEncoding due to encoding 
being null.

this is header for effective pom while being written to the xml:
{noformat}
<?xml version="1.0" encoding="null"?>
<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Generated by Maven Help Plugin on 2018-03-17T15:04:57                  -->
<!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
<!--                                                                        -->
<!-- ====================================================================== -->
<projects>
  <!-- ====================================================================== 
-->
  <!--                                                                        
-->
  <!-- Effective POM for project                                              
-->
  <!-- 'org.example:example-parent:pom:1.0-SNAPSHOT'                          
-->
  <!--                                                                        
-->
  <!-- ====================================================================== 
-->
  <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>{noformat}
Encoding null then percolates and result in npe, whose stacktrace is thrown out.

Pom example:
{noformat}
<project xmlns="http://maven.apache.org/POM/4.0.0";>
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>example-parent</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <modules>
    <module>modules/moduleA</module>
    <module>modules/moduleB</module>
  </modules>
</project>{noformat}
 As far as i can understand main problem is in:

org.apache.maven.plugins.help.EffectivePomMojo#execute
{noformat}
String encoding = output != null ? project.getModel().getModelEncoding()
                        : System.getProperty( "file.encoding" );{noformat}
 If project.getModel().getEncoding() is 'null' (this is true in my case) we 
will get null encoding and writing to the file will result in NPE being thrown. 

I think we should default to system property value if model encoding is null.

 

 

 


was (Author: muhanga):
I am too impacted by this issue. As far as i can debug this one is related to 
the "null" encoding formed in effective pom output.

As a result effective pom looks 'fine' when outputed to console but breaks on 
 org.codehaus.plexus.util.xml.XmlStreamWriter#detectEncoding due to encoding 
being null.

this is header for effective pom while being written to the xml:
{noformat}
<?xml version="1.0" encoding="null"?>
<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Generated by Maven Help Plugin on 2018-03-17T15:04:57                  -->
<!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
<!--                                                                        -->
<!-- ====================================================================== -->
<projects>
  <!-- ====================================================================== 
-->
  <!--                                                                        
-->
  <!-- Effective POM for project                                              
-->
  <!-- 'org.example:example-parent:pom:1.0-SNAPSHOT'                          
-->
  <!--                                                                        
-->
  <!-- ====================================================================== 
-->
  <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>{noformat}
Encoding null then percolates and result in npe, whose stacktrace is thrown out.

Pom example:
{noformat}
<project xmlns="http://maven.apache.org/POM/4.0.0";>
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>example-parent</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <modules>
    <module>modules/moduleA</module>
    <module>modules/moduleB</module>
  </modules>
</project>{noformat}
 

 

> 3.0 effective-pom will crash builds
> -----------------------------------
>
>                 Key: MPH-135
>                 URL: https://issues.apache.org/jira/browse/MPH-135
>             Project: Maven Help Plugin
>          Issue Type: Bug
>            Reporter: Hans-Joachim Kliemeck
>            Priority: Blocker
>
> Hi,
> we see build failures on all our pipelines with the new version 3.0.0. Is 
> this an official version or was this version recalled? Is there a breaking 
> change related to xml parsing / encoding?
> [https://github.com/apache/maven-help-plugin/releases/tag/maven-help-plugin-3.0.0]
> {code:java}
> 13:45:17 INFO - 
> ------------------------------------------------------------------------
> 13:45:17 ERROR - Failed to execute goal 
> org.apache.maven.plugins:maven-help-plugin:3.0.0:effective-pom (default-cli) 
> on project composites: Execution default-cli of goal 
> org.apache.maven.plugins:maven-help-plugin:3.0.0:effective-pom failed. 
> NullPointerException -> [Help 1]
> 13:45:17 INFO - org.apache.maven.lifecycle.LifecycleExecutionException: 
> Failed to execute goal 
> org.apache.maven.plugins:maven-help-plugin:3.0.0:effective-pom (default-cli) 
> on project composites: Execution default-cli of goal 
> org.apache.maven.plugins:maven-help-plugin:3.0.0:effective-pom failed.
> 13:45:17 INFO -       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
> 13:45:17 INFO -       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> 13:45:17 INFO -       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> 13:45:17 INFO -       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
> 13:45:17 INFO -       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
> 13:45:17 INFO -       at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> 13:45:17 INFO -       at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
> 13:45:17 INFO -       at 
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
> 13:45:17 INFO -       at 
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
> 13:45:17 INFO -       at 
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
> 13:45:17 INFO -       at 
> org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
> 13:45:17 INFO -       at 
> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
> 13:45:17 INFO -       at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
> 13:45:17 INFO -       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
> 13:45:17 INFO -       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 13:45:17 INFO -       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 13:45:17 INFO -       at java.lang.reflect.Method.invoke(Method.java:483)
> 13:45:17 INFO -       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> 13:45:17 INFO -       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> 13:45:17 INFO -       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> 13:45:17 INFO -       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> 13:45:17 INFO - Caused by: org.apache.maven.plugin.PluginExecutionException: 
> Execution default-cli of goal 
> org.apache.maven.plugins:maven-help-plugin:3.0.0:effective-pom failed.
> 13:45:17 INFO -       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
> 13:45:17 INFO -       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
> 13:45:17 INFO -       ... 20 more
> 13:45:17 INFO - Caused by: java.lang.NullPointerException
> 13:45:17 INFO -       at 
> org.codehaus.plexus.util.xml.XmlStreamWriter.close(XmlStreamWriter.java:75)
> 13:45:17 INFO -       at 
> org.codehaus.plexus.util.IOUtil.close(IOUtil.java:796)
> 13:45:17 INFO -       at 
> org.apache.maven.plugins.help.AbstractEffectiveMojo.writeXmlFile(AbstractEffectiveMojo.java:96)
> 13:45:17 INFO -       at 
> org.apache.maven.plugins.help.EffectivePomMojo.execute(EffectivePomMojo.java:139)
> 13:45:17 INFO -       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
> 13:45:17 INFO -       ... 21 more
> 13:45:17 ERROR - 
> 13:45:17 ERROR - Re-run Maven using the -X switch to enable full debug 
> logging.
> {code}
> Best Regards
> Hajo



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to