[ 
https://jira.codehaus.org/browse/MECLIPSE-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=331953#comment-331953
 ] 

Jean-François Lecomte commented on MECLIPSE-746:
------------------------------------------------

Analysing the code of the eclipse:eclipse plugin, I see the following method:

{code:title=IdeDependency.java|borderStyle=solid}
    /**
     * @return <tt>true</tt> if this dependency is a Java API
     */
    public boolean isJavaApi()
    {
        return groupId.startsWith( "java." ) || groupId.startsWith( "javax." );
    }
{code}

in the class IdeDependency. It is being called in the class 
EclipseClasspathWriter with the following code:

{code:title=EclipseClasspathWriter.java|borderStyle=solid}
        // 
----------------------------------------------------------------------
        // Java API dependencies that may complete the classpath container must
        // be declared BEFORE all other dependencies so that container access 
rules don't fail
        // 
----------------------------------------------------------------------
        IdeDependency[] depsToWrite = config.getDeps();
        for ( int j = 0; j < depsToWrite.length; j++ )
        {
            IdeDependency dep = depsToWrite[j];
            if ( dep.isJavaApi() )
            {
                String depId = getDependencyId( dep );
                if ( !addedDependencies.contains( depId ) )
                {
                    addDependency( writer, dep );
                    addedDependencies.add( depId );
                }
            }
        }
{code}


Maybe the isJavaApi() should validate that the type is "jar"?
                
> Non-Jar type dependency generates invalid entry in .classpath file
> ------------------------------------------------------------------
>
>                 Key: MECLIPSE-746
>                 URL: https://jira.codehaus.org/browse/MECLIPSE-746
>             Project: Maven Eclipse Plugin
>          Issue Type: Bug
>    Affects Versions: 2.9
>            Reporter: Jean-François Lecomte
>            Priority: Minor
>
> Not sure if it is a good practice, but when a JAR requires a DLL at runtime, 
> I add it in the maven repo. It usually works fine, I use the dependency 
> plugin to copy the dll in my working directory and when I generate my eclipse 
> project, they are not included in the classpath... except for one case: the 
> javax.comm's dll.
> I refer to my DLL like this:
> {code:xml}
>         <dependency>
>             <groupId>javax.comm</groupId>
>             <artifactId>win32com</artifactId>
>             <version>3.0-u1</version>
>             <type>dll</type>
>             <scope>runtime</scope>
>         </dependency>
> {code}
> When I generate the eclipse project using the command:
> {noformat}
> mvn eclipse:eclipse
> {noformat}
> the generated .classpath file contains:
> {code:xml}
>   <classpathentry kind="var" 
> path="M2_REPO/javax/comm/win32com/3.0-u1/win32com-3.0-u1.dll"/>
> {code}
> When loading the project in Eclipse, I get the following error:
> "Archive for required library: 
> '.m2/repository/javax/comm/win32com/3.0-u1/win32com-3.0-u1.dll' in project 
> '...' cannot be read or is not a valid ZIP file"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to