@@ -26,6 +26,45 @@ apply plugin: 'nebula.maven-scm'
26
26
27
27
archivesBaseName = ' elasticsearch-core'
28
28
29
+ // we want to keep the JDKs in our IDEs set to JDK 8 until minimum JDK is bumped to 9 so we do not include this source set in our IDEs
30
+ if (! isEclipse && ! isIdea) {
31
+ sourceSets {
32
+ java9 {
33
+ java {
34
+ srcDirs = [' src/main/java9' ]
35
+ }
36
+ }
37
+ }
38
+
39
+ configurations {
40
+ java9Compile. extendsFrom(compile)
41
+ }
42
+
43
+ dependencies {
44
+ java9Compile sourceSets. main. output
45
+ }
46
+
47
+ compileJava9Java {
48
+ sourceCompatibility = 9
49
+ targetCompatibility = 9
50
+ }
51
+
52
+ /* Enable this when forbiddenapis was updated to 2.6.
53
+ * See: https://github.com/elastic/elasticsearch/issues/29292
54
+ forbiddenApisJava9 {
55
+ targetCompatibility = 9
56
+ }
57
+ */
58
+
59
+ jar {
60
+ metaInf {
61
+ into ' versions/9'
62
+ from sourceSets. java9. output
63
+ }
64
+ manifest. attributes(' Multi-Release' : ' true' )
65
+ }
66
+ }
67
+
29
68
publishing {
30
69
publications {
31
70
nebula {
@@ -39,6 +78,10 @@ dependencies {
39
78
testCompile " junit:junit:${ versions.junit} "
40
79
testCompile " org.hamcrest:hamcrest-all:${ versions.hamcrest} "
41
80
81
+ if (! isEclipse && ! isIdea) {
82
+ java9Compile sourceSets. main. output
83
+ }
84
+
42
85
if (isEclipse == false || project. path == " :libs:elasticsearch-core-tests" ) {
43
86
testCompile(" org.elasticsearch.test:framework:${ version} " ) {
44
87
exclude group : ' org.elasticsearch' , module : ' elasticsearch-core'
@@ -52,29 +95,6 @@ forbiddenApisMain {
52
95
signaturesURLs = [PrecommitTasks . getResource(' /forbidden/jdk-signatures.txt' )]
53
96
}
54
97
55
- // we want to keep the JDKs in our IDEs set to JDK 8 until minimum JDK is bumped to 9 so we do not include this source set in our IDEs
56
- if (! isEclipse && ! isIdea) {
57
- sourceSets {
58
- java9 {
59
- java {
60
- srcDirs = [' src/main/java9' ]
61
- }
62
- }
63
- }
64
-
65
- compileJava9Java {
66
- sourceCompatibility = 9
67
- targetCompatibility = 9
68
- }
69
-
70
- jar {
71
- into(' META-INF/versions/9' ) {
72
- from sourceSets. java9. output
73
- }
74
- manifest. attributes(' Multi-Release' : ' true' )
75
- }
76
- }
77
-
78
98
if (isEclipse) {
79
99
// in eclipse the project is under a fake root, we need to change around the source sets
80
100
sourceSets {
0 commit comments