Quantcast

How to set exported property in .classpath file.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to set exported property in .classpath file.

ruimo
This post has NOT been accepted by the mailing list yet.
Hi,

I'm using Gradle 1.7 and having trouble to create eclipse .classpath file. Eclipse plugin for Gradle seems to set exported property to 'true' even if the library is testCompile group. As a result, junit and mockito library will be deployed to application server If I import the project to Eclipse.
I tried the following:

shouldExcluded = configurations.testCompile.dependencies.inject(new HashSet(), {s, v -> s + "$v.group:$v.name:$v.version"})

eclipse.classpath.file {
  beforeMerged { classpath ->
    classpath.entries.clear()
  }
  whenMerged { cp ->
    cp.entries.findAll {
      (it instanceof or.gradle.plugins.ide.eclipse.model.Library) &&
      shouldExcluded.contains("$it.moduleVersion")
    }*.exported = false
  }
}

It can exclude libraries in testCompile group such as JUnit. But cannot excluded hamcrest library that is dependency of JUnit.

Question:
Can I set exported property to false for testCompile group libraries?
Loading...