[GRADLE-1707] Eclipse plugin should eliminate Eclipse warning: Classpath entry ... will not be exported or published Created: 30/Jul/11  Updated: 04/Jan/13  Resolved: 17/Mar/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-3
Fix Version/s: None

Type: Improvement
Reporter: David Oliver Assignee: Szczepan Faber
Resolution: Duplicate Votes: 1


 Description   

All of the Eclipse plugin generated classpath variables make Eclipse generate an inappropriate error message for every one:
Classpath entry ... will not be exported or published

Gradle Eclipse plugin should be able to eliminate such errors somehow such as making this entry as described below:

By adding an attribute as described here the inappropriate error can be eliminated
http://www.ghosthack.com/2010/01/classpath-entry-jar-will-not-be.html
<classpathentry kind="var" path="M2_REPO/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>



 Comments   
Comment by Peng Deng [ 31/Aug/11 ]

As mentioned in GRADLE-1134, this can be walked around with customized script. Though after milestone-4, you can add "org.eclipse.jst.component.dependency" to those with exported="true", and "org.eclipse.jst.component.nondependency" to those not exported.

eclipse {
  project {
    name = 'helloworld'
  }

  classpath {
    plusConfigurations += configurations.providedCompile

    noExportConfigurations += configurations.providedCompile

    file {
      withXml {
        xml -> xml.asNode().classpathentry.findAll{
          it.@kind == 'lib'
        }.each{
          it.appendNode('attributes').appendNode(
            'attribute',
            [
              name: it.@exported ? 'org.eclipse.jst.component.dependency' : 'org.eclipse.jst.component.nondependency',
              value: it.@exported ? '/WEB-INF/lib' : ''
            ]
          )
        }
      }
    }
  }
}
Comment by Szczepan Faber [ 17/Mar/12 ]

This is a duplicate of: GRADLE-1134

Let's move the discussion there.

Generated at Wed Jun 30 12:02:19 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.