NPE when inheriting report sets
-------------------------------

         Key: MNG-1529
         URL: http://jira.codehaus.org/browse/MNG-1529
     Project: Maven 2
        Type: Bug
  Components: maven-project  
    Versions: 2.0    
 Environment: JDK 1.5.0_05, Kubuntu linux 5.1
    Reporter: Arik Kfir


I have three POMs:

A: serves as a template for new projects
B: Extends A - the root POM of a multi-module project
C: Extends B - a module in the B project

One of the things project A defines is the <reporting> element. However, when I 
try to build project B, I get the following exception:

[EMAIL PROTECTED]:~/projects/swinger$ mvn clean
[INFO] Scanning for projects...
[INFO] snapshot org.corleon:parent:1.1-SNAPSHOT: checking for updates from 
corleon
[INFO] 
----------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] 
----------------------------------------------------------------------------
[INFO] null
[INFO] 
----------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
        at java.util.TreeMap.compare(TreeMap.java:1093)
        at java.util.TreeMap.getEntry(TreeMap.java:347)
        at java.util.TreeMap.containsKey(TreeMap.java:204)
        at 
org.apache.maven.project.ModelUtils.mergeReportPluginDefinitions(ModelUtils.java:324)
        at 
org.apache.maven.project.ModelUtils.mergeReportPluginLists(ModelUtils.java:156)
        at 
org.apache.maven.project.inheritance.DefaultModelInheritanceAssembler.assembleReportingInheritance(DefaultModelInheritanceAssembler.java:277)
        at 
org.apache.maven.project.inheritance.DefaultModelInheritanceAssembler.assembleModelInheritance(DefaultModelInheritanceAssembler.java:170)
        at 
org.apache.maven.project.inheritance.DefaultModelInheritanceAssembler.assembleModelInheritance(DefaultModelInheritanceAssembler.java:56)
        at 
org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:605)
        at 
org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFile(DefaultMavenProjectBuilder.java:298)
        at 
org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:276)
        at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:509)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:441)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:485)
        at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:345)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:276)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] 
----------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Sat Nov 12 13:45:14 IST 2005
[INFO] Final Memory: 1M/2M
[INFO] 
----------------------------------------------------------------------------

I tracked down the problem to the <reporting> element in project A, because 
when I remove it, things work again. I believe there's a problem in the way 
maven merges reporting info from parent POMs (well..duh).

Here is the reporting data in project A:
  <reporting>
    <plugins>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>dependencies</report>
              <report>project-team</report>
              <report>license</report>
              <report>scm</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>changes-maven-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>changes-report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>surefire-report-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>taglist-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

It appears it is not a specific plugin, but rather the appearance of the 
<reportSet> element. I've tried with both the javadoc and the project-info 
plugins - both cause the NPE when they have atleast one <reportSet> element. 
Having an empty <reportSets> (with no <reportSet> elements) does not cause the 
exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to