Java okhttp-gson: fix dependencies

This commit is contained in:
xhh 2016-02-15 16:48:58 +08:00
parent af594ea652
commit 908ab83d9b
4 changed files with 27 additions and 24 deletions

View File

@ -23,7 +23,7 @@ if(hasProperty('target') && target == 'android') {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.github.dcendents.android-maven'
android { android {
compileSdkVersion 22 compileSdkVersion 22
buildToolsVersion '22.0.0' buildToolsVersion '22.0.0'
@ -35,7 +35,7 @@ if(hasProperty('target') && target == 'android') {
sourceCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
// Rename the aar correctly // Rename the aar correctly
libraryVariants.all { variant -> libraryVariants.all { variant ->
variant.outputs.each { output -> variant.outputs.each { output ->
@ -51,7 +51,7 @@ if(hasProperty('target') && target == 'android') {
provided 'javax.annotation:jsr250-api:1.0' provided 'javax.annotation:jsr250-api:1.0'
} }
} }
afterEvaluate { afterEvaluate {
android.libraryVariants.all { variant -> android.libraryVariants.all { variant ->
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
@ -63,12 +63,12 @@ if(hasProperty('target') && target == 'android') {
artifacts.add('archives', task); artifacts.add('archives', task);
} }
} }
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs from android.sourceSets.main.java.srcDirs
classifier = 'sources' classifier = 'sources'
} }
artifacts { artifacts {
archives sourcesJar archives sourcesJar
} }
@ -77,16 +77,16 @@ if(hasProperty('target') && target == 'android') {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'maven' apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_7 sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7
install { install {
repositories.mavenInstaller { repositories.mavenInstaller {
pom.artifactId = '{{artifactId}}' pom.artifactId = '{{artifactId}}'
} }
} }
task execute(type:JavaExec) { task execute(type:JavaExec) {
main = System.getProperty('mainClass') main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath classpath = sourceSets.main.runtimeClasspath
@ -95,8 +95,8 @@ if(hasProperty('target') && target == 'android') {
dependencies { dependencies {
compile 'io.swagger:swagger-annotations:1.5.0' compile 'io.swagger:swagger-annotations:1.5.0'
compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'com.squareup.okhttp:okhttp:2.7.2'
compile 'com.squareup.okhttp:logging-interceptor:2.7.2'
compile 'com.google.code.gson:gson:2.3.1' compile 'com.google.code.gson:gson:2.3.1'
compile 'com.brsanthu:migbase64:2.2'
testCompile 'junit:junit:4.8.1' testCompile 'junit:junit:4.8.1'
} }

View File

@ -10,9 +10,9 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal, resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.0", "io.swagger" % "swagger-annotations" % "1.5.0",
"com.squareup.okhttp" % "okhttp" % "2.4.0", "com.squareup.okhttp" % "okhttp" % "2.7.2",
"com.squareup.okhttp" % "logging-interceptor" % "2.7.2",
"com.google.code.gson" % "gson" % "2.3.1", "com.google.code.gson" % "gson" % "2.3.1",
"com.brsanthu" % "migbase64" % "2.2",
"junit" % "junit" % "4.8.1" % "test" "junit" % "junit" % "4.8.1" % "test"
) )
) )

View File

@ -1,3 +1,6 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'io.swagger' group = 'io.swagger'
version = '1.0.0' version = '1.0.0'
@ -20,7 +23,7 @@ if(hasProperty('target') && target == 'android') {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.github.dcendents.android-maven'
android { android {
compileSdkVersion 22 compileSdkVersion 22
buildToolsVersion '22.0.0' buildToolsVersion '22.0.0'
@ -32,7 +35,7 @@ if(hasProperty('target') && target == 'android') {
sourceCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
// Rename the aar correctly // Rename the aar correctly
libraryVariants.all { variant -> libraryVariants.all { variant ->
variant.outputs.each { output -> variant.outputs.each { output ->
@ -48,7 +51,7 @@ if(hasProperty('target') && target == 'android') {
provided 'javax.annotation:jsr250-api:1.0' provided 'javax.annotation:jsr250-api:1.0'
} }
} }
afterEvaluate { afterEvaluate {
android.libraryVariants.all { variant -> android.libraryVariants.all { variant ->
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
@ -60,12 +63,12 @@ if(hasProperty('target') && target == 'android') {
artifacts.add('archives', task); artifacts.add('archives', task);
} }
} }
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs from android.sourceSets.main.java.srcDirs
classifier = 'sources' classifier = 'sources'
} }
artifacts { artifacts {
archives sourcesJar archives sourcesJar
} }
@ -74,16 +77,16 @@ if(hasProperty('target') && target == 'android') {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'maven' apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_7 sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7
install { install {
repositories.mavenInstaller { repositories.mavenInstaller {
pom.artifactId = 'swagger-petstore-okhttp-gson' pom.artifactId = 'swagger-petstore-okhttp-gson'
} }
} }
task execute(type:JavaExec) { task execute(type:JavaExec) {
main = System.getProperty('mainClass') main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath classpath = sourceSets.main.runtimeClasspath
@ -92,8 +95,8 @@ if(hasProperty('target') && target == 'android') {
dependencies { dependencies {
compile 'io.swagger:swagger-annotations:1.5.0' compile 'io.swagger:swagger-annotations:1.5.0'
compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'com.squareup.okhttp:okhttp:2.7.2'
compile 'com.squareup.okhttp:logging-interceptor:2.7.2'
compile 'com.google.code.gson:gson:2.3.1' compile 'com.google.code.gson:gson:2.3.1'
compile 'com.brsanthu:migbase64:2.2'
testCompile 'junit:junit:4.8.1' testCompile 'junit:junit:4.8.1'
} }

View File

@ -10,9 +10,9 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal, resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.0", "io.swagger" % "swagger-annotations" % "1.5.0",
"com.squareup.okhttp" % "okhttp" % "2.4.0", "com.squareup.okhttp" % "okhttp" % "2.7.2",
"com.squareup.okhttp" % "logging-interceptor" % "2.7.2",
"com.google.code.gson" % "gson" % "2.3.1", "com.google.code.gson" % "gson" % "2.3.1",
"com.brsanthu" % "migbase64" % "2.2",
"junit" % "junit" % "4.8.1" % "test" "junit" % "junit" % "4.8.1" % "test"
) )
) )