ide-integration.gradle 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import org.gradle.plugins.ide.eclipse.model.SourceFolder
  2. configure(allprojects) {
  3. apply plugin: 'idea'
  4. apply plugin: 'eclipse'
  5. eclipse.project.name = "${project.name}-3.2.x"
  6. }
  7. configure(javaProjects) {
  8. eclipse.classpath.downloadSources = true
  9. // http://forums.gradle.org/gradle/topics/eclipse_wtp_deploys_testcode_to_server_example_provided
  10. eclipse.classpath {
  11. defaultOutputDir = file('bin/main')
  12. file.whenMerged { cp ->
  13. cp.entries.findAll { it instanceof SourceFolder && (it.path.contains("test") || it.path.contains("Test")) }*.output = "bin/test"
  14. }
  15. }
  16. // GRADLE-1422
  17. project.eclipseClasspath.doFirst {
  18. // delay adding whenMerged till the entryAttributes are added (must be the last whenMerged)
  19. project.eclipse.classpath.file.whenMerged { classpath ->
  20. def includeDeps = project.configurations.getByName('runtime').collect {f -> f.absolutePath } as Set
  21. classpath.entries.each { cp ->
  22. if(cp instanceof org.gradle.plugins.ide.eclipse.model.Library) {
  23. def include = includeDeps.contains(cp.path)
  24. def attr = 'org.eclipse.jst.component.dependency'
  25. if(!include) {
  26. cp.entryAttributes.remove(attr)
  27. }
  28. }
  29. }
  30. }
  31. }
  32. }