Skip to content

Commit 4977652

Browse files
committed
Add module-test project to recreate the problem
Fix invalid module name `org.spockframework.groovy2-compat` -> `org.spockframework.groovy2compat` not that it really matters since `groovy2compat` does fundamentally not work with the module system.
1 parent b8bfe54 commit 4977652

File tree

6 files changed

+40
-17
lines changed

6 files changed

+40
-17
lines changed

Diff for: settings.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,22 @@ include "spock-spring"
2929
include "spock-spring:spring3-test"
3030
include "spock-guice"
3131
include "spock-junit4"
32-
include "spock-temp"
3332
include "spock-testkit"
3433

3534
if ((System.getProperty("variant") as BigDecimal ?: 2.5) != 3.0) {
3635
//Remove once Groovy 2.5 support is dropped
3736
include "spock-groovy2-compat"
37+
} else if (JavaVersion.current().isJava9Compatible()) {
38+
// works only in Java 9+ and groovy 3+ as spock-groovy2-compat is incompatible with the module system
39+
include "spock-module-test"
3840
}
3941

4042
// https://issues.apache.org/jira/projects/TAP5/issues/TAP5-2588
4143
if (JavaVersion.current().isJava8()) {
4244
include "spock-tapestry"
4345
}
4446

47+
4548
include "spock-unitils"
4649
include "spock-gradle"
4750

Diff for: spock-groovy2-compat/groovy2-compat.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jar {
1818
'Implementation-Title': project.name,
1919
'Implementation-Version': variantLessVersion,
2020
'Implementation-Vendor': 'spockframework.org',
21-
'Automatic-Module-Name': 'org.spockframework.groovy2-compat'
21+
'Automatic-Module-Name': 'org.spockframework.groovy2compat'
2222
)
2323
}
2424
}

Diff for: spock-temp/temp.gradle renamed to spock-module-test/module-test.gradle

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ ext.displayName = "Spock Framework - Temp Specs for Core Module"
22

33
apply plugin: "spock-base"
44

5-
//configurations {
6-
// junit
7-
//}
8-
95
dependencies {
106
testCompile project(":spock-core")
117

128
testRuntime libs.asm
139
testRuntime libs.bytebuddy
1410
testRuntime libs.cglib
1511
testRuntime libs.objenesis
16-
testRuntime libs.h2database
17-
18-
// junit libs.junit4
1912
}
2013

2114
sourceCompatibility = javaVersion
2215
targetCompatibility = javaVersion
2316

24-
// necessary to make @NotYetImplemented transform work (transform that ships
25-
// with Groovy and statically references third-party class junit.framwork.AssertionFailedError)
26-
//tasks.withType(GroovyCompile) {
27-
// groovyClasspath += configurations.junit
28-
//}
17+
tasks.withType(JavaCompile) {
18+
sourceCompatibility = javaVersion
19+
targetCompatibility = javaVersion
20+
options.compilerArgs -= ['--release', '8']
21+
options.encoding = 'UTF-8'
22+
}
23+
24+
java {
25+
// enable module path
26+
modularity.inferModulePath = true
27+
}
28+
2929

3030
test {
3131
useJUnitPlatform()
3232
reports.junitXml.enabled = true
33-
reports.html.enabled = false
33+
reports.html.enabled = true
3434

3535
testLogging.exceptionFormat = "full"
3636
testLogging.showExceptions = true

Diff for: spock-temp/src/test/groovy/temp/FirstSpec.groovy renamed to spock-module-test/src/test/groovy/org/acme/test/ModuleSmokeSpec.groovy

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package temp
1+
package org.acme.test
22

33
import spock.lang.Specification
44

5-
class FirstSpec extends Specification{
5+
class ModuleSmokeSpec extends Specification{
66

77
def "works"() {
88
expect: true

Diff for: spock-module-test/src/test/java/module-info.java

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
open module org.acme.test {
2+
exports org.acme.test;
3+
4+
requires java.desktop;
5+
6+
requires org.spockframework.core;
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.acme.test;
2+
3+
public class PojoClass {
4+
private String id;
5+
6+
public String getId() {
7+
return id;
8+
}
9+
10+
public void setId(String id) {
11+
this.id = id;
12+
}
13+
}

0 commit comments

Comments
 (0)