Module file (.iml) is generated in a way that sources and javadocs are not 
recognized by Intellij Idea
------------------------------------------------------------------------------------------------------
                 Key: MIDEA-100
                 URL: http://jira.codehaus.org/browse/MIDEA-100
             Project: Maven 2.x IDEA Plugin
          Issue Type: Bug
    Affects Versions: 2.1
         Environment: WIndows XP, Maven 2.0.7, Java 1.6, IntelliJ IDEA 7.0M1b
            Reporter: Gerhard Mueller
            Priority: Critical


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,


-- 
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

        

Reply via email to