Skip to content

Commit 762f59b

Browse files
committed
Configure compiler conventions in modules
This commit applies the Compiler Conventions Gradle plugin to the project modules and fix the issues raised by the compiler linter. This commit also moves version management to the main build file for a few dependencies, aligning the versions in the process.
1 parent 5c5554b commit 762f59b

File tree

12 files changed

+51
-22
lines changed

12 files changed

+51
-22
lines changed

build.gradle

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ subprojects {
2828

2929
configure(moduleProjects) {
3030
apply plugin: 'java-library'
31+
apply plugin: 'org.springframework.graphql.compiler'
3132

3233
java {
3334
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -41,17 +42,33 @@ configure(moduleProjects) {
4142
mavenBom "org.springframework:spring-framework-bom:5.3.9"
4243
mavenBom "org.springframework.data:spring-data-bom:2021.0.4"
4344
mavenBom "org.springframework.security:spring-security-bom:5.5.2"
45+
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.5.2"
4446
mavenBom "org.junit:junit-bom:5.7.2"
4547
}
4648
dependencies {
4749
dependency "com.graphql-java:graphql-java:${graphQlJavaVersion}"
48-
dependency 'org.assertj:assertj-core:3.20.2'
50+
dependency "javax.annotation:javax.annotation-api:1.3.2"
51+
dependency "javax.servlet:javax.servlet-api:4.0.1"
52+
dependency "com.google.code.findbugs:jsr305:3.0.2"
53+
dependency "org.assertj:assertj-core:3.20.2"
54+
dependency "com.jayway.jsonpath:json-path:2.5.0"
55+
dependency "org.skyscreamer:jsonassert:1.5.0"
56+
dependencySet(group: 'com.querydsl', version: '4.4.0') {
57+
entry 'querydsl-apt'
58+
entry 'querydsl-collections'
59+
entry 'querydsl-core'
60+
}
4961
dependencySet(group: 'org.apache.logging.log4j', version: '2.14.1') {
5062
entry 'log4j-api'
5163
entry 'log4j-core'
5264
entry 'log4j-jul'
5365
entry 'log4j-slf4j-impl'
5466
}
67+
dependencySet(group: 'org.mockito', version: '3.11.2') {
68+
entry 'mockito-core'
69+
entry 'mockito-inline'
70+
entry 'mockito-junit-jupiter'
71+
}
5572
}
5673
generatedPomCustomization {
5774
enabled = false

graphql-spring-boot-starter/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import org.springframework.boot.gradle.plugin.SpringBootPlugin
33
plugins {
44
id 'org.springframework.boot' version "${bootVersion}" apply false
55
id 'java-library'
6+
id 'org.springframework.graphql.compiler'
67
}
78

89
group = 'org.springframework.experimental'
@@ -41,13 +42,14 @@ dependencies {
4142
compileOnly 'org.springframework.security:spring-security-config'
4243
compileOnly 'org.springframework.security:spring-security-web'
4344

44-
compileOnly 'com.querydsl:querydsl-core:4.4.0'
45+
compileOnly 'com.querydsl:querydsl-core'
4546
compileOnly 'org.springframework.data:spring-data-commons'
4647

4748
compileOnly project(':spring-graphql-test')
49+
compileOnly 'org.junit.jupiter:junit-jupiter-api'
4850
compileOnly 'org.springframework.boot:spring-boot-test'
4951

50-
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
52+
compileOnly 'com.google.code.findbugs:jsr305'
5153
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
5254
annotationProcessor 'org.springframework.boot:spring-boot-autoconfigure-processor'
5355

graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/InvalidSchemaLocationsException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @author Brian Clozel
3131
* @since 1.0.0
3232
*/
33+
@SuppressWarnings("serial")
3334
public class InvalidSchemaLocationsException extends NestedRuntimeException {
3435

3536
private final List<SchemaLocation> schemaLocations;

samples/webmvc-http/build.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@ dependencies {
1313
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
1414
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
1515
implementation 'org.springframework.boot:spring-boot-starter-actuator'
16+
implementation 'com.querydsl:querydsl-core'
17+
implementation 'com.querydsl:querydsl-jpa'
1618
developmentOnly 'org.springframework.boot:spring-boot-devtools'
1719
runtimeOnly 'com.h2database:h2'
1820
testImplementation project(':spring-graphql-test')
1921
testImplementation 'org.springframework:spring-webflux'
2022
testImplementation 'org.springframework.boot:spring-boot-starter-test'
2123

22-
implementation(
23-
"com.querydsl:querydsl-core:4.4.0",
24-
"com.querydsl:querydsl-jpa:4.4.0"
25-
)
26-
annotationProcessor "com.querydsl:querydsl-apt:4.4.0:jpa",
27-
"org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final",
28-
"javax.annotation:javax.annotation-api:1.3.2"
24+
annotationProcessor 'com.querydsl:querydsl-apt:4.4.0:jpa',
25+
'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final',
26+
'javax.annotation:javax.annotation-api'
2927
}
3028

3129
compileJava {

spring-graphql-test/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ dependencies {
66
api 'io.projectreactor:reactor-core'
77
api 'org.springframework:spring-context'
88
api 'org.springframework:spring-test'
9-
api 'com.jayway.jsonpath:json-path:2.5.0'
9+
api 'com.jayway.jsonpath:json-path'
1010

11-
compileOnly "javax.annotation:javax.annotation-api:1.3.2"
11+
compileOnly 'javax.annotation:javax.annotation-api'
1212
compileOnly 'org.springframework:spring-webflux'
1313
compileOnly 'org.springframework:spring-webmvc'
1414
compileOnly 'org.springframework:spring-websocket'
15-
compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
16-
compileOnly 'org.skyscreamer:jsonassert:1.5.0'
15+
compileOnly 'javax.servlet:javax.servlet-api'
16+
compileOnly 'org.skyscreamer:jsonassert'
17+
compileOnly 'com.google.code.findbugs:jsr305'
18+
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core'
1719

1820
testImplementation 'org.junit.jupiter:junit-jupiter'
1921
testImplementation 'org.assertj:assertj-core'
20-
testImplementation 'org.mockito:mockito-core:3.8.0'
21-
testImplementation 'org.skyscreamer:jsonassert:1.5.0'
22+
testImplementation 'org.mockito:mockito-core'
23+
testImplementation 'org.skyscreamer:jsonassert'
2224
testImplementation 'org.springframework:spring-webflux'
2325
testImplementation 'org.springframework:spring-test'
2426
testImplementation 'io.projectreactor:reactor-test'

spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQlError.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
*
3535
* @author Rossen Stoyanchev
3636
*/
37+
@SuppressWarnings("serial")
3738
class TestGraphQlError implements GraphQLError {
3839

3940
@Nullable

spring-graphql/build.gradle

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,31 @@ dependencies {
55
api 'io.projectreactor:reactor-core'
66
api 'org.springframework:spring-context'
77

8-
compileOnly "javax.annotation:javax.annotation-api:1.3.2"
8+
compileOnly 'javax.annotation:javax.annotation-api'
99
compileOnly 'org.springframework:spring-webflux'
1010
compileOnly 'org.springframework:spring-webmvc'
1111
compileOnly 'org.springframework:spring-websocket'
12-
compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
12+
compileOnly 'javax.servlet:javax.servlet-api'
1313

1414
compileOnly 'org.springframework.security:spring-security-core'
1515

16-
compileOnly 'com.querydsl:querydsl-core:4.4.0'
16+
compileOnly 'com.querydsl:querydsl-core'
1717
compileOnly 'org.springframework.data:spring-data-commons'
1818

19+
compileOnly 'com.google.code.findbugs:jsr305'
20+
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core'
21+
1922
testImplementation 'org.junit.jupiter:junit-jupiter'
2023
testImplementation 'org.assertj:assertj-core'
21-
testImplementation 'org.mockito:mockito-core:3.11.1'
24+
testImplementation 'org.mockito:mockito-core'
2225
testImplementation 'io.projectreactor:reactor-test'
2326
testImplementation 'org.springframework:spring-webflux'
2427
testImplementation 'org.springframework:spring-webmvc'
2528
testImplementation 'org.springframework:spring-websocket'
2629
testImplementation 'org.springframework:spring-test'
2730
testImplementation 'org.springframework.data:spring-data-commons'
28-
testImplementation 'com.querydsl:querydsl-core:4.4.0'
29-
testImplementation 'javax.servlet:javax.servlet-api:4.0.1'
31+
testImplementation 'com.querydsl:querydsl-core'
32+
testImplementation 'javax.servlet:javax.servlet-api'
3033
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
3134

3235
testRuntimeOnly 'org.apache.logging.log4j:log4j-core'

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/MissingArgumentException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* @author Rossen Stoyanchev
2626
* @since 1.0.0
2727
*/
28+
@SuppressWarnings("serial")
2829
public class MissingArgumentException extends NestedRuntimeException {
2930

3031
private final String argumentName;

spring-graphql/src/main/java/org/springframework/graphql/execution/ExceptionResolversExceptionHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class ExceptionResolversExceptionHandler implements DataFetcherExceptionHandler
5757
}
5858

5959
@Override
60+
@Deprecated
6061
public DataFetcherExceptionHandlerResult onException(DataFetcherExceptionHandlerParameters parameters) {
6162
Throwable exception = parameters.getException();
6263
exception = ((exception instanceof CompletionException) ? exception.getCause() : exception);

spring-graphql/src/main/java/org/springframework/graphql/execution/MissingSchemaException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* @author Brian Clozel
2525
* @since 1.0.0
2626
*/
27+
@SuppressWarnings("serial")
2728
public class MissingSchemaException extends NestedRuntimeException {
2829

2930
public MissingSchemaException() {

spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ static <V> Flux<V> close(WebSocketSession session, CloseStatus status) {
314314

315315
}
316316

317+
@SuppressWarnings("serial")
317318
private static class SubscriptionExistsException extends RuntimeException {
318319

319320
}

spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ public void hookOnComplete() {
466466

467467
}
468468

469+
@SuppressWarnings("serial")
469470
private static class SubscriptionExistsException extends RuntimeException {
470471

471472
}

0 commit comments

Comments
 (0)