ide-integration.gradle 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. apply plugin: 'idea'
  2. configure(javaProjects) {
  3. apply plugin: 'idea'
  4. apply plugin: 'eclipse-wtp'
  5. eclipse.classpath.downloadSources = true
  6. tasks.withType(org.gradle.plugins.ide.eclipse.GenerateEclipseWtpComponent) {
  7. project.eclipse.classpath.file.whenMerged { classpath->
  8. project.eclipse.wtp.component.file.whenMerged { wtpComponent ->
  9. wtpComponent.contextPath = project.tasks.findByName('jettyRun')?.contextPath?.replaceFirst('/','')
  10. }
  11. }
  12. }
  13. }
  14. project(':spring-security-samples-aspectj') {
  15. task afterEclipseImport {
  16. ext.srcFile = file('.classpath')
  17. inputs.file srcFile
  18. outputs.dir srcFile
  19. onlyIf { srcFile.exists() }
  20. doLast {
  21. def classpath = new XmlParser().parse(srcFile)
  22. classpath.classpathentry.findAll{ it.@path == '/spring-security-aspects' }.each { node ->
  23. if(node.children().size() == 0) {
  24. def attrs = new Node(node,'attributes')
  25. def adjtAttr = new Node(attrs,'attributes',[name: 'org.eclipse.ajdt.aspectpath', value: 'org.eclipse.ajdt.aspectpath'])
  26. node.appendNode(adjtAttr)
  27. }
  28. }
  29. def writer = new FileWriter(srcFile)
  30. new XmlNodePrinter(new PrintWriter(writer)).print(classpath)
  31. }
  32. }
  33. }