Issue Details (XML | Word | Printable)

Key: MNG-1529
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: John Casey
Reporter: Arik Kfir
Votes: 3
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Maven 2

NPE when inheriting report sets

Created: 12/Nov/05 06:04 AM   Updated: 01/Feb/06 02:45 PM
Component/s: Inheritance and Interpolation
Affects Version/s: 2.0
Fix Version/s: 2.0.1

Time Tracking:
Not Specified

File Attachments: 1. File MNG-1539-test-case.tar.bz2 (2 kB)

Environment: JDK 1.5.0_05, Kubuntu linux 5.1

Complexity: Intermediate


 Description  « Hide
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:

arik@corleon:~/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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Joakim Erdfelt added a comment - 02/Dec/05 10:21 AM
I have been experiencing this NPE also.

I have attached a small sample project/test case to demonstrate
this bug.

Note: I still use maven 2.0 final (not 2.0.1).


Joakim Erdfelt added a comment - 02/Dec/05 10:23 AM
Pardon the fat-fingered, incorrectly labeled filename.

The attachment is for this jira - MNG-1529.
The filename is wrong in saying (MNG-1539). sorry.


John Casey added a comment - 14/Dec/05 06:29 PM
forgot to close earlier....