-
Notifications
You must be signed in to change notification settings - Fork 0
/
eclipse.gradle
64 lines (60 loc) · 2.55 KB
/
eclipse.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import org.gradle.plugins.ide.eclipse.model.SourceFolder
apply plugin: 'eclipse'
tasks.eclipse.doFirst {
File prefs = file(".settings/org.eclipse.buildship.core.prefs")
if(!prefs.exists()){
prefs.append('''
connection.project.dir=
eclipse.preferences.version=1
'''.stripIndent())
}
}
eclipse {
classpath {
defaultOutputDir = file ('bin/default')
file {
beforeMerged { classpath ->
classpath.entries.removeAll { it.kind == "src" }
}
whenMerged { classpath ->
// classpath.entries.removeAll { it.kind == "con" }
classpath.entries.findAll { it instanceof SourceFolder && it.path.startsWith("src/main") }*.output = "bin/default"
classpath.entries.findAll { it instanceof SourceFolder && it.path.startsWith("src/test") }*.output = "bin/test"
classpath.entries.findAll { it instanceof SourceFolder && it.path.startsWith(".apt_generated") }*.output = "bin/default"
classpath.entries.findAll { it instanceof SourceFolder && it.path.startsWith(".apt_generated_tests") }*.output = "bin/test"
// classpath.entries.removeAll { it.kind == "output" }
}
withXml { provider ->
def node = provider.asNode()
node.appendNode( 'classpathentry', [ kind: 'con', path: "org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"])
// node.appendNode( 'classpathentry', [ kind: 'src', output: 'bin/main', path: '.apt_generated'])
}
}
}
jdt {
file {
withProperties {properties ->
properties.setProperty('org.eclipse.jdt.core.compiler.processAnnotations', 'enabled')
}
}
}
project {
natures 'org.eclipse.buildship.core.gradleprojectnature'
// natures 'org.springframework.ide.eclipse.core.springnature'
buildCommand 'org.springframework.ide.eclipse.core.springbuilder'
buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
}
}
eclipseJdt {
doLast {
file('.factorypath').withWriter { writer ->
def domaJar = configurations.annotationProcessor.find {
it.name.startsWith('doma-2')
}
new groovy.xml.MarkupBuilder(writer).factorypath() {
factorypathentry(kind:'EXTJAR', id:domaJar, enabled:true, runInBatchMode:false)
}
}
mkdir('.apt_generated')
}
}