ide.gradle 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import org.gradle.plugins.ide.eclipse.model.SourceFolder
  2. apply plugin: 'eclipse-wtp'
  3. apply plugin: 'propdeps-idea'
  4. apply plugin: 'propdeps-eclipse'
  5. eclipse.classpath.downloadSources = true
  6. eclipse {
  7. classpath {
  8. plusConfigurations += [ configurations.integrationTestCompile ]
  9. }
  10. }
  11. // http://forums.gradle.org/gradle/topics/eclipse_wtp_deploys_testcode_to_server_example_provided
  12. eclipse.classpath {
  13. defaultOutputDir = file('bin/main')
  14. file.whenMerged { cp ->
  15. cp.entries.findAll { it instanceof SourceFolder && (it.path.contains("test") || it.path.contains("Test")) }*.output = "bin/test"
  16. }
  17. }
  18. // GRADLE-1116
  19. project.eclipse.classpath.file.whenMerged { classpath ->
  20. classpath.entries.removeAll { entry -> entry.path.endsWith('/build/resources/test') }
  21. classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/test') }
  22. classpath.entries.removeAll { entry -> entry.path.endsWith('/build/resources/main') }
  23. classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/main') }
  24. }
  25. // GRADLE-1422
  26. project.eclipseClasspath.doFirst {
  27. // delay adding whenMerged till the entryAttributes are added (must be the last whenMerged)
  28. project.eclipse.classpath.file.whenMerged { classpath ->
  29. def includeDeps = project.configurations.getByName('runtime').collect {f -> f.absolutePath } as Set
  30. classpath.entries.each { cp ->
  31. if(cp instanceof org.gradle.plugins.ide.eclipse.model.Library) {
  32. def include = includeDeps.contains(cp.path)
  33. def attr = 'org.eclipse.jst.component.dependency'
  34. if(!include) {
  35. cp.entryAttributes.remove(attr)
  36. }
  37. }
  38. }
  39. }
  40. }
  41. project.idea.module {
  42. scopes.TEST.plus += [project.configurations.integrationTestRuntime]
  43. testSourceDirs += sourceSets.integrationTest.resources.srcDirs
  44. }