forked from loafle/openapi-generator-original
Add build files for Gradle and SBT
This commit is contained in:
parent
2fd8b8ff16
commit
3112e4ad06
@ -163,9 +163,13 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
// library-specific files
|
// library-specific files
|
||||||
if ("okhttp-gson".equals(getLibrary())) {
|
if ("okhttp-gson".equals(getLibrary())) {
|
||||||
// the "okhttp-gson" library template requires "ApiCallback.mustache"
|
// the "okhttp-gson" library template requires "ApiCallback.mustache" for async call
|
||||||
// and does not require "TypeRef.mustache"
|
|
||||||
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));
|
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));
|
||||||
|
// "build.gradle" is for development with Gradle
|
||||||
|
supportingFiles.add(new SupportingFile("build.gradle.mustache", "", "build.gradle"));
|
||||||
|
// "build.sbt" is for development with SBT
|
||||||
|
supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt"));
|
||||||
|
// and does not require "TypeRef.mustache"
|
||||||
} else {
|
} else {
|
||||||
supportingFiles.add(new SupportingFile("TypeRef.mustache", invokerFolder, "TypeRef.java"));
|
supportingFiles.add(new SupportingFile("TypeRef.mustache", invokerFolder, "TypeRef.java"));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'io.swagger:swagger-annotations:1.5.0'
|
||||||
|
compile 'com.squareup.okhttp:okhttp:2.4.0'
|
||||||
|
compile 'com.google.code.gson:gson:2.3.1'
|
||||||
|
compile 'com.brsanthu:migbase64:2.2'
|
||||||
|
testCompile 'junit:junit:4.8.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = '{{groupId}}'
|
||||||
|
version = '{{artifactVersion}}'
|
||||||
|
|
||||||
|
install {
|
||||||
|
repositories.mavenInstaller {
|
||||||
|
pom.artifactId = '{{artifactId}}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task execute(type:JavaExec) {
|
||||||
|
main = System.getProperty('mainClass')
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
lazy val root = (project in file(".")).
|
||||||
|
settings(
|
||||||
|
organization := "{{groupId}}",
|
||||||
|
name := "{{artifactId}}",
|
||||||
|
version := "{{artifactVersion}}",
|
||||||
|
scalaVersion := "2.11.4",
|
||||||
|
scalacOptions ++= Seq("-feature"),
|
||||||
|
javacOptions in compile ++= Seq("-Xlint:deprecation"),
|
||||||
|
publishArtifact in (Compile, packageDoc) := false,
|
||||||
|
resolvers += Resolver.mavenLocal,
|
||||||
|
libraryDependencies ++= Seq(
|
||||||
|
"io.swagger" % "swagger-annotations" % "1.5.0",
|
||||||
|
"com.squareup.okhttp" % "okhttp" % "2.4.0",
|
||||||
|
"com.google.code.gson" % "gson" % "2.3.1",
|
||||||
|
"com.brsanthu" % "migbase64" % "2.2",
|
||||||
|
"junit" % "junit" % "4.8.1" % "test"
|
||||||
|
)
|
||||||
|
)
|
28
samples/client/petstore/java/okhttp-gson/build.gradle
Normal file
28
samples/client/petstore/java/okhttp-gson/build.gradle
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'io.swagger:swagger-annotations:1.5.0'
|
||||||
|
compile 'com.squareup.okhttp:okhttp:2.4.0'
|
||||||
|
compile 'com.google.code.gson:gson:2.3.1'
|
||||||
|
compile 'com.brsanthu:migbase64:2.2'
|
||||||
|
testCompile 'junit:junit:4.8.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'io.swagger'
|
||||||
|
version = '1.0.0'
|
||||||
|
|
||||||
|
install {
|
||||||
|
repositories.mavenInstaller {
|
||||||
|
pom.artifactId = 'swagger-petstore-okhttp-gson'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task execute(type:JavaExec) {
|
||||||
|
main = System.getProperty('mainClass')
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
}
|
18
samples/client/petstore/java/okhttp-gson/build.sbt
Normal file
18
samples/client/petstore/java/okhttp-gson/build.sbt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
lazy val root = (project in file(".")).
|
||||||
|
settings(
|
||||||
|
organization := "io.swagger",
|
||||||
|
name := "swagger-petstore-okhttp-gson",
|
||||||
|
version := "1.0.0",
|
||||||
|
scalaVersion := "2.11.4",
|
||||||
|
scalacOptions ++= Seq("-feature"),
|
||||||
|
javacOptions in compile ++= Seq("-Xlint:deprecation"),
|
||||||
|
publishArtifact in (Compile, packageDoc) := false,
|
||||||
|
resolvers += Resolver.mavenLocal,
|
||||||
|
libraryDependencies ++= Seq(
|
||||||
|
"io.swagger" % "swagger-annotations" % "1.5.0",
|
||||||
|
"com.squareup.okhttp" % "okhttp" % "2.4.0",
|
||||||
|
"com.google.code.gson" % "gson" % "2.3.1",
|
||||||
|
"com.brsanthu" % "migbase64" % "2.2",
|
||||||
|
"junit" % "junit" % "4.8.1" % "test"
|
||||||
|
)
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user