update build.gradle to work with gradle 7.x, add test (#10669)

This commit is contained in:
William Cheng
2021-10-24 12:19:52 +08:00
committed by GitHub
parent ec2ed98269
commit 2413783288
5 changed files with 41 additions and 28 deletions

View File

@@ -31,6 +31,7 @@ jobs:
- samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8
- samples/openapi3/client/petstore/java/jersey2-java8-special-characters
- samples/openapi3/client/petstore/java/jersey2-java8
- samples/client/petstore/java/okhttp-gson
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2

View File

@@ -9,8 +9,7 @@ version = '{{artifactVersion}}'
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2" }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
@@ -19,7 +18,7 @@ buildscript {
}
repositories {
jcenter()
mavenCentral()
}
{{#sourceFolder}}
sourceSets {
@@ -84,14 +83,17 @@ if(hasProperty('target') && target == 'android') {
} else {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
install {
repositories.mavenInstaller {
pom.artifactId = '{{artifactId}}'
publishing {
publications {
maven(MavenPublication) {
artifactId = '{{artifactId}}'
from components.java
}
}
}
@@ -130,6 +132,7 @@ dependencies {
{{/dynamicOperations}}
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.mockito:mockito-core:3.11.2'
}
javadoc {

View File

@@ -7,8 +7,7 @@ version = '1.0.0'
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2" }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
@@ -17,7 +16,7 @@ buildscript {
}
repositories {
jcenter()
mavenCentral()
}
sourceSets {
main.java.srcDirs = ['src/main/java']
@@ -80,14 +79,17 @@ if(hasProperty('target') && target == 'android') {
} else {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
install {
repositories.mavenInstaller {
pom.artifactId = 'petstore-okhttp-gson-dynamicoperations'
publishing {
publications {
maven(MavenPublication) {
artifactId = 'petstore-okhttp-gson-dynamicoperations'
from components.java
}
}
}
@@ -115,6 +117,7 @@ dependencies {
implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.23'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.mockito:mockito-core:3.11.2'
}
javadoc {

View File

@@ -7,8 +7,7 @@ version = '1.0.0'
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2" }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
@@ -17,7 +16,7 @@ buildscript {
}
repositories {
jcenter()
mavenCentral()
}
sourceSets {
main.java.srcDirs = ['src/main/java']
@@ -80,14 +79,17 @@ if(hasProperty('target') && target == 'android') {
} else {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
install {
repositories.mavenInstaller {
pom.artifactId = 'petstore-okhttp-gson-parcelableModel'
publishing {
publications {
maven(MavenPublication) {
artifactId = 'petstore-okhttp-gson-parcelableModel'
from components.java
}
}
}
@@ -114,6 +116,7 @@ dependencies {
implementation 'org.threeten:threetenbp:1.4.3'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.mockito:mockito-core:3.11.2'
}
javadoc {

View File

@@ -7,8 +7,7 @@ version = '1.0.0'
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2" }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
@@ -17,7 +16,7 @@ buildscript {
}
repositories {
jcenter()
mavenCentral()
}
sourceSets {
main.java.srcDirs = ['src/main/java']
@@ -80,14 +79,17 @@ if(hasProperty('target') && target == 'android') {
} else {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
install {
repositories.mavenInstaller {
pom.artifactId = 'petstore-okhttp-gson'
publishing {
publications {
maven(MavenPublication) {
artifactId = 'petstore-okhttp-gson'
from components.java
}
}
}
@@ -114,6 +116,7 @@ dependencies {
implementation 'org.threeten:threetenbp:1.4.3'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.mockito:mockito-core:3.11.2'
}
javadoc {