diff --git a/build.gradle b/build.gradle index 506fdfd..1601036 100644 --- a/build.gradle +++ b/build.gradle @@ -1,104 +1,81 @@ -apply plugin: 'idea' -apply plugin: 'eclipse' -apply plugin: 'java' -apply plugin: 'com.diffplug.spotless' +plugins { + id 'idea' + id 'eclipse' + id 'java' + id 'signing' + id 'com.diffplug.spotless' version '6.13.0' + id 'maven-publish' +} group = 'com.kintone' version = '0.0.1-SNAPSHOT' -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' - } -} - repositories { mavenCentral() } -sourceSets { - main.java.srcDirs = ['src/main/java'] -} -if(hasProperty('target') && target == 'android') { +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +task javadocJar(type: Jar) { + archiveClassifier = 'javadoc' + from javadoc +} - apply plugin: 'com.android.library' - apply plugin: 'com.github.dcendents.android-maven' +task sourcesJar(type: Jar) { + archiveClassifier = 'sources' + from sourceSets.main.allSource +} - android { - compileSdkVersion 25 - buildToolsVersion '25.0.2' - defaultConfig { - minSdkVersion 14 - targetSdkVersion 25 - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } +artifacts { + archives javadocJar, sourcesJar +} - // Rename the aar correctly - libraryVariants.all { variant -> - variant.outputs.each { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith('.aar')) { - def fileName = "${project.name}-${variant.baseName}-${version}.aar" - output.outputFile = new File(outputFile.parent, fileName) +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'kintone-rest-client-java' + from components.java + pom { + name = 'kintone-rest-client-java' + description = 'API client library for Kintone REST APIs on Java.' + url = 'https://github.com/kintone/kintone-rest-client-java' + licenses { + license { + name = 'The MIT License' + url = 'https://opensource.org/licenses/MIT' + } + } + developers { + developer { + name = 'cybozu' + email = 'oss@cybozu.com' + } + } + scm { + connection = 'https://github.com/kintone/kintone-rest-client-java.git' + url = 'https://github.com/kintone/kintone-rest-client-java' } } } - - dependencies { - provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - } - } - - afterEvaluate { - android.libraryVariants.all { variant -> - def task = project.tasks.create "jar${variant.name.capitalize()}", Jar - task.description = "Create jar artifact for ${variant.name}" - task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDirectory - task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") - task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" - artifacts.add('archives', task) - } - } - - task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' - } - - artifacts { - archives sourcesJar } - -} else { - - apply plugin: 'java' - apply plugin: 'maven-publish' - - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - - publishing { - publications { - maven(MavenPublication) { - artifactId = 'kintone-rest-client' - from components.java + repositories { + maven { + def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2" + def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots" + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) { + credentials { + username = "${sonatypeUsername}" + password = "${sonatypePassword}" + } } } } +} - task execute(type:JavaExec) { - main = System.getProperty('mainClass') - classpath = sourceSets.main.runtimeClasspath - } +signing { + sign publishing.publications.mavenJava } ext { diff --git a/build.sbt b/build.sbt deleted file mode 100644 index 9d0d474..0000000 --- a/build.sbt +++ /dev/null @@ -1,27 +0,0 @@ -lazy val root = (project in file(".")). - settings( - organization := "com.kintone", - name := "kintone-rest-client", - version := "0.0.1-SNAPSHOT", - 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.6.5", - "com.squareup.okhttp3" % "okhttp" % "4.12.0", - "com.squareup.okhttp3" % "logging-interceptor" % "4.12.0", - "com.google.code.gson" % "gson" % "2.9.1", - "org.apache.commons" % "commons-lang3" % "3.17.0", - "jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6", - "org.openapitools" % "jackson-databind-nullable" % "0.2.6", - "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", - "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", - "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "org.junit.jupiter" % "junit-jupiter-api" % "5.10.3" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test", - "org.mockito" % "mockito-core" % "3.12.4" % "test" - ) - ) diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/pom.xml b/pom.xml deleted file mode 100644 index c981215..0000000 --- a/pom.xml +++ /dev/null @@ -1,340 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>com.kintone</groupId> - <artifactId>kintone-rest-client</artifactId> - <packaging>jar</packaging> - <name>kintone-rest-client</name> - <version>0.0.1-SNAPSHOT</version> - <url>https://github.com/openapitools/openapi-generator</url> - <description>OpenAPI Java</description> - <scm> - <connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection> - <developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection> - <url>https://github.com/openapitools/openapi-generator</url> - </scm> - - <licenses> - <license> - <name>Unlicense</name> - <url>http://unlicense.org</url> - <distribution>repo</distribution> - </license> - </licenses> - - <developers> - <developer> - <name>OpenAPI-Generator Contributors</name> - <email>team@openapitools.org</email> - <organization>OpenAPITools.org</organization> - <organizationUrl>http://openapitools.org</organizationUrl> - </developer> - </developers> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.1</version> - <configuration> - <fork>true</fork> - <meminitial>128m</meminitial> - <maxmem>512m</maxmem> - <compilerArgs> - <arg>-Xlint:all</arg> - <arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. --> - </compilerArgs> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-enforcer-plugin</artifactId> - <version>3.4.1</version> - <executions> - <execution> - <id>enforce-maven</id> - <goals> - <goal>enforce</goal> - </goals> - <configuration> - <rules> - <requireMavenVersion> - <version>2.2.0</version> - </requireMavenVersion> - </rules> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.22.2</version> - <configuration> - <systemPropertyVariables> - <property> - <name>loggerPath</name> - <value>conf/log4j.properties</value> - </property> - </systemPropertyVariables> - <argLine>-Xms512m -Xmx1500m</argLine> - <parallel>methods</parallel> - <threadCount>10</threadCount> - </configuration> - <dependencies> - <!--Custom provider and engine for Junit 5 to surefire--> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit-version}</version> - </dependency> - </dependencies> - </plugin> - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <version>3.6.1</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - <!-- attach test jar --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>3.3.0</version> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - <configuration> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>3.5.0</version> - <executions> - <execution> - <id>add_sources</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>src/main/java</source> - </sources> - </configuration> - </execution> - <execution> - <id>add_test_sources</id> - <phase>generate-test-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>src/test/java</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>3.6.3</version> - <executions> - <execution> - <id>attach-javadocs</id> - <goals> - <goal>jar</goal> - </goals> - </execution> - </executions> - <configuration> - <doclint>none</doclint> - <tags> - <tag> - <name>http.response.details</name> - <placement>a</placement> - <head>Http Response Details:</head> - </tag> - </tags> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <version>3.3.0</version> - <executions> - <execution> - <id>attach-sources</id> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - <!-- Use spotless plugin to automatically format code, remove unused import, etc - To apply changes directly to the file, run `mvn spotless:apply` - Ref: https://github.com/diffplug/spotless/tree/main/plugin-maven - --> - <plugin> - <groupId>com.diffplug.spotless</groupId> - <artifactId>spotless-maven-plugin</artifactId> - <version>${spotless.version}</version> - <configuration> - <formats> - <!-- you can define as many formats as you want, each is independent --> - <format> - <!-- define the files to apply to --> - <includes> - <include>.gitignore</include> - </includes> - <!-- define the steps to apply to those files --> - <trimTrailingWhitespace/> - <endWithNewline/> - <indent> - <spaces>true</spaces> <!-- or <tabs>true</tabs> --> - <spacesPerTab>4</spacesPerTab> <!-- optional, default is 4 --> - </indent> - </format> - </formats> - <!-- define a language-specific format --> - <java> - <!-- no need to specify files, inferred automatically, but you can if you want --> - - <!-- apply a specific flavor of google-java-format and reflow long strings --> - <googleJavaFormat> - <version>1.8</version> - <style>AOSP</style> - <reflowLongStrings>true</reflowLongStrings> - </googleJavaFormat> - - <removeUnusedImports/> - <importOrder/> - - </java> - </configuration> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>sign-artifacts</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-gpg-plugin</artifactId> - <version>3.2.1</version> - <executions> - <execution> - <id>sign-artifacts</id> - <phase>verify</phase> - <goals> - <goal>sign</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> - - <dependencies> - <!-- @Nullable annotation --> - <dependency> - <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> - <version>3.0.2</version> - </dependency> - <dependency> - <groupId>com.squareup.okhttp3</groupId> - <artifactId>okhttp</artifactId> - <version>${okhttp-version}</version> - </dependency> - <dependency> - <groupId>com.squareup.okhttp3</groupId> - <artifactId>logging-interceptor</artifactId> - <version>${okhttp-version}</version> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>${gson-version}</version> - </dependency> - <dependency> - <groupId>io.gsonfire</groupId> - <artifactId>gson-fire</artifactId> - <version>${gson-fire-version}</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons-lang3-version}</version> - </dependency> - <dependency> - <groupId>jakarta.annotation</groupId> - <artifactId>jakarta.annotation-api</artifactId> - <version>${jakarta-annotation-version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.openapitools</groupId> - <artifactId>jackson-databind-nullable</artifactId> - <version>${jackson-databind-nullable-version}</version> - </dependency> - <dependency> - <groupId>jakarta.ws.rs</groupId> - <artifactId>jakarta.ws.rs-api</artifactId> - <version>${jakarta.ws.rs-api-version}</version> - </dependency> - <!-- test dependencies --> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.platform</groupId> - <artifactId>junit-platform-runner</artifactId> - <version>${junit-platform-runner.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - <properties> - <java.version>1.8</java.version> - <maven.compiler.source>${java.version}</maven.compiler.source> - <maven.compiler.target>${java.version}</maven.compiler.target> - <gson-fire-version>1.9.0</gson-fire-version> - <okhttp-version>4.12.0</okhttp-version> - <gson-version>2.10.1</gson-version> - <commons-lang3-version>3.17.0</commons-lang3-version> - <jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version> - <jakarta-annotation-version>1.3.5</jakarta-annotation-version> - <beanvalidation-version>2.0.2</beanvalidation-version> - <junit-version>5.10.3</junit-version> - <junit-platform-runner.version>1.10.0</junit-platform-runner.version> - <jakarta.ws.rs-api-version>2.1.6</jakarta.ws.rs-api-version> - <jsr311-api-version>1.1.1</jsr311-api-version> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <spotless.version>2.43.0</spotless.version> - </properties> -</project>