11plugins {
22 base
3- id(" com.diffplug.eclipse.apt" ) version " 3.33.1 " apply false
4- id(" com.diffplug.spotless" ) version " 5.17.1 "
5- id(" de.marcphilipp.nexus-publish" ) version " 0.4.0 " apply false
6- id(" io.codearte.nexus-staging" ) version " 0.30.0 "
7- id(" net.researchgate.release" ) version " 2.8.1 "
8- id(" org.seasar.doma.compile" ) version " 1.1.0 " apply false
9- kotlin(" jvm" ) version " 1.5.31 " apply false
10- kotlin(" kapt" ) version " 1.6.0-RC " apply false
3+ id(" com.diffplug.eclipse.apt" ) apply false
4+ id(" com.diffplug.spotless" )
5+ id(" de.marcphilipp.nexus-publish" ) apply false
6+ id(" io.codearte.nexus-staging" )
7+ id(" net.researchgate.release" )
8+ id(" org.seasar.doma.compile" ) apply false
9+ kotlin(" jvm" ) apply false
10+ kotlin(" kapt" ) apply false
1111}
1212
1313val Project .javaModuleName: String
@@ -34,6 +34,32 @@ fun replaceVersionInArtifact(ver: String) {
3434 }
3535}
3636
37+ fun org.gradle.plugins.ide.eclipse.model.EclipseModel.configure (javaRuntimeName : String ) {
38+ classpath {
39+ file {
40+ whenMerged {
41+ val classpath = this as org.gradle.plugins.ide.eclipse.model.Classpath
42+ classpath.entries.removeAll {
43+ when (it) {
44+ is org.gradle.plugins.ide.eclipse.model.Output -> it.path == " .apt_generated"
45+ else -> false
46+ }
47+ }
48+ }
49+ withXml {
50+ val node = asNode()
51+ node.appendNode(
52+ " classpathentry" ,
53+ mapOf (" kind" to " src" , " output" to " bin/main" , " path" to " .apt_generated" )
54+ )
55+ }
56+ }
57+ }
58+ jdt {
59+ this .javaRuntimeName = javaRuntimeName
60+ }
61+ }
62+
3763allprojects {
3864 apply (plugin = " com.diffplug.spotless" )
3965
@@ -49,7 +75,7 @@ allprojects {
4975}
5076
5177subprojects {
52- apply (plugin = " java-library " )
78+ apply (plugin = " java" )
5379
5480 dependencies {
5581 " testImplementation" (" org.junit.jupiter:junit-jupiter-api:5.8.1" )
@@ -113,7 +139,7 @@ configure(modularProjects) {
113139 val signingKey: String? by project
114140 val signingPassword: String? by project
115141 useInMemoryPgpKeys(signingKey, signingPassword)
116- val publishing = convention.findByType (PublishingExtension ::class )!!
142+ val publishing = extensions.getByType (PublishingExtension ::class )
117143 sign(publishing.publications)
118144 isRequired = isReleaseVersion
119145 }
@@ -130,29 +156,7 @@ configure(modularProjects) {
130156 }
131157
132158 configure< org.gradle.plugins.ide.eclipse.model.EclipseModel > {
133- classpath {
134- file {
135- whenMerged {
136- val classpath = this as org.gradle.plugins.ide.eclipse.model.Classpath
137- classpath.entries.removeAll {
138- when (it) {
139- is org.gradle.plugins.ide.eclipse.model.Output -> it.path == " .apt_generated"
140- else -> false
141- }
142- }
143- }
144- withXml {
145- val node = asNode()
146- node.appendNode(
147- " classpathentry" ,
148- mapOf (" kind" to " src" , " output" to " bin/main" , " path" to " .apt_generated" )
149- )
150- }
151- }
152- }
153- jdt {
154- javaRuntimeName = " JavaSE-1.8"
155- }
159+ configure(" JavaSE-1.8" )
156160 }
157161
158162 class ModulePathArgumentProvider (it : Project ) : CommandLineArgumentProvider, Named {
@@ -266,10 +270,6 @@ configure(modularProjects) {
266270 dependsOn(" publishToMavenLocal" )
267271 }
268272
269- withType<JavaCompile >().configureEach {
270- modularity.inferModulePath.set(false )
271- }
272-
273273 withType<Sign >().configureEach {
274274 onlyIf { isReleaseVersion }
275275 }
@@ -282,10 +282,6 @@ configure(integrationTestProjects) {
282282 apply (plugin = " com.diffplug.spotless" )
283283 apply (plugin = " org.seasar.doma.compile" )
284284
285- repositories {
286- mavenCentral()
287- }
288-
289285 dependencies {
290286 " testImplementation" (platform(" org.testcontainers:testcontainers-bom:1.16.2" ))
291287 " testRuntimeOnly" (" com.h2database:h2:1.4.200" )
@@ -300,29 +296,7 @@ configure(integrationTestProjects) {
300296 }
301297
302298 configure< org.gradle.plugins.ide.eclipse.model.EclipseModel > {
303- classpath {
304- file {
305- whenMerged {
306- val classpath = this as org.gradle.plugins.ide.eclipse.model.Classpath
307- classpath.entries.removeAll {
308- when (it) {
309- is org.gradle.plugins.ide.eclipse.model.Output -> it.path == " .apt_generated"
310- else -> false
311- }
312- }
313- }
314- withXml {
315- val node = asNode()
316- node.appendNode(
317- " classpathentry" ,
318- mapOf (" kind" to " src" , " output" to " bin/main" , " path" to " .apt_generated" )
319- )
320- }
321- }
322- }
323- jdt {
324- javaRuntimeName = " JavaSE-17"
325- }
299+ configure(" JavaSE-17" )
326300 }
327301
328302 tasks {
0 commit comments