Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2.1
-
Fix Version/s: 2.2
-
Component/s: None
-
Labels:None
-
Environment:WIndows XP, Maven 2.0.7, Java 1.6, IntelliJ IDEA 7.0M1b
-
Number of attachments :
Description
When a new iml file is generated with mvn idea:idea -DdownloadSources=true -DdownloadJavadocs=true
the generated .iml-file contains invalid entries for the javadocs and sources, like in this example:
<orderEntry type="module-library">
<library>
<JAVADOC/>
<SOURCES/>
<CLASSES>
<root url="jar://C:/Dokumente und Einstellungen/muellerg/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar!/" />
</CLASSES>
<SOURCES>
<root url="jar://C:/Dokumente und Einstellungen/muellerg/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0-sources.jar!/" />
</SOURCES>
<JAVADOC>
<root url="jar://C:/Dokumente und Einstellungen/muellerg/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0-javadoc.jar!/" />
</JAVADOC>
</library>
</orderEntry>
Removing the empty
<JAVADOC/>
<SOURCES/>
entries allows me to see the sources, but this is not a good solution.
By looking at the source code https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
the reason might be the method
private Element createOrGetElement( Element lib, String name )
{
Element el = lib.element( "name" );
if ( el == null )
{
el = createElement( lib, name );
}
return el;
}
In my opinion, the method should look like this:
private Element createOrGetElement( Element lib, String name )
{
Element el = lib.element( name ); // CHANGE DONE HERE
if ( el == null )
{ el = createElement( lib, name ); } }
return el;
}
as otherwiese ALWAYS new element instances are created, regardless the provided name to look for,
I just tried this on another project and I can not reproduce what you describe. I only get one SOURCES and one JAVADOC tag per dependency/module-library. Did you check the .iml file before opening it in IDEA?
Please supply a sample project that can be used to illustrate the problem.