11
22plugins {
3- // Apply the java-library plugin for API and implementation separation.
3+ // NOTE: this block is managed by scripts/fix-build-gradle.sh, changes made
4+ // to the plugins block by hand will be overwritten!
45 id ' java-library'
6+ id ' java'
7+ id " nebula.lint" version " 17.8.0"
8+ id ' checkstyle'
59 id ' maven-publish'
610 id ' signing'
11+ id ' cl.franciscosolis.sonatype-central-upload' version ' 1.0.0'
712}
813
14+
915compileJava. options. encoding = " UTF-8"
1016compileTestJava. options. encoding = " UTF-8"
1117
@@ -29,7 +35,7 @@ model {
2935jar {
3036 dependsOn(" :generatePomFileForMavenPublication" )
3137
32- into(" META-INF/maven/com.styra.opa/openapi " ) {
38+ into(" META-INF/maven/com.styra/opa " ) {
3339 from(" $buildDir /pom.xml" )
3440 }
3541}
@@ -62,9 +68,9 @@ publishing {
6268
6369 publications {
6470 maven(MavenPublication ) {
65- groupId = ' com.styra.opa '
66- artifactId = ' openapi '
67- version = ' 0.6.7 '
71+ groupId = ' com.styra'
72+ artifactId = ' opa '
73+ version = ' 0.6.8 '
6874
6975 from components. java
7076
@@ -114,8 +120,74 @@ dependencies {
114120 implementation ' org.openapitools:jackson-databind-nullable:0.2.6'
115121 implementation ' org.apache.httpcomponents:httpclient:4.5.14'
116122 implementation ' org.apache.httpcomponents:httpmime:4.5.14'
117- implementation ' com.jayway.jsonpath:json-path:2.9.0'
118123 implementation ' commons-io:commons-io:2.15.1'
119124}
120125
121126
127+ // === build-footer ===
128+ // NOTE: lines in build.gradle below this comment are managed by
129+ // scripts/fix-build-gradle.sh and should not be managed by hand, as changes
130+ // will be overwritten.
131+
132+ tasks. withType(Javadoc ) {
133+ autoLintGradle. enabled = false
134+ failOnError false
135+ }
136+
137+ // https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/5
138+ //
139+ // This prevents Checkstyle from running on ./gradlew build, but keeps it
140+ // working for ./gradlew lint.
141+ checkstyle {
142+ sourceSets = []
143+ }
144+
145+ // Exclude files generated by Speakeasy from linting.
146+ tasks. withType(Checkstyle ) {
147+ configFile = file(" ${ project.rootDir} /config/checkstyle/checkstyle.xml" )
148+ exclude ' com/styra/opa/openapi/**/*.java'
149+ exclude ' com/styra/opa/openapi/*.java'
150+ }
151+
152+ task lint {
153+ autoLintGradle. enabled = true
154+ dependsOn checkstyleTest
155+ dependsOn checkstyleMain
156+ gradleLint {
157+ criticalRules= [' all-dependency' ]
158+ reportFormat = ' text'
159+ excludedRules = [
160+ // Enabling recommended-versions causes Gradle to complain about
161+ // testcontainers, but applying the suggested fix (removing the version
162+ // numbers from all but one of the testImplementation lines) causes
163+ // gradle to fail in a more obscure way that I don't understand.
164+ " recommended-versions"
165+ ]
166+ }
167+ }
168+
169+ dependencies {
170+ testImplementation ' org.junit.jupiter:junit-jupiter-api:5.8.2'
171+ runtimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.8.2'
172+ testImplementation ' org.testcontainers:testcontainers-bom:1.19.7'
173+ testImplementation ' org.testcontainers:testcontainers:1.19.7'
174+ testImplementation ' org.testcontainers:junit-jupiter:1.19.7'
175+
176+ implementation ' com.fasterxml.jackson.core:jackson-annotations:2.17.0'
177+ implementation ' com.fasterxml.jackson.core:jackson-core:2.17.0'
178+ implementation ' org.apache.httpcomponents:httpcore:4.4.16'
179+ }
180+
181+ test {
182+ useJUnitPlatform()
183+ testLogging {
184+ // uncomment for more verbose output during development
185+ // events "passed", "skipped", "failed", "standard_out", "standard_error"
186+ }
187+ }
188+
189+ gradle. projectsEvaluated {
190+ tasks. withType(JavaCompile ) {
191+ options. compilerArgs << " -Xlint:unchecked"
192+ }
193+ }
0 commit comments