-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.gradle
More file actions
58 lines (48 loc) · 1.73 KB
/
build.gradle
File metadata and controls
58 lines (48 loc) · 1.73 KB
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
plugins {
id 'java'
id 'org.unbroken-dome.xjc' version '1.4.1' // https://github.com/unbroken-dome/gradle-xjc-plugin
id 'idea'
id 'groovy' // For Spock tests
}
group 'info.hubbitus'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
ext{
pluginVersion = '1.1'
}
dependencies {
xjcClasspath "info.hubbitus:xjc-documentation-annotation-plugin:$pluginVersion"
// Compile dependency for annotations used
compile "info.hubbitus:xjc-documentation-annotation-plugin:$pluginVersion"
testCompile "info.hubbitus:xjc-documentation-annotation-plugin:$pluginVersion"
// Tests
testCompile 'org.codehaus.groovy:groovy:2.5.5'
testCompile 'org.spockframework:spock-core:1.2-groovy-2.5'
}
// Results will be in directory `src/main/generated-java`
xjcGenerate {
/**
* There:
* 1. Example.xsd is minimal example of functional.
* 2. maven-4.0.0.xsd - example by SOq https://stackoverflow.com/questions/42223784/how-can-i-generate-a-class-from-which-i-can-retrieve-the-xml-of-a-node-as-a-stri
*/
source = fileTree('src/main/resources') { include '*.xsd' }
bindingFiles = fileTree('src/main/jaxb') { include '*.xjb' }
outputDirectory = file('src/main/generated-java')
packageLevelAnnotations = false
targetPackage = 'info.hubbitus.xjc.plugin.example'
extraArgs = [ '-XPluginDescriptionAnnotation' ]
}
// Add generated files into compilation:
// https://stackoverflow.com/questions/36749015/how-do-i-get-intellij-to-recognize-gradle-generated-sources-dir/44740130#44740130
sourceSets.main.java.srcDir new File(buildDir, xjcGenerate.outputDirectory.absolutePath)
idea {
module {
// Marks the already(!) added srcDir as "generated"
generatedSourceDirs += xjcGenerate.outputDirectory
}
}
compileTestGroovy.dependsOn xjcGenerate