|
| 1 | + |
| 2 | +plugins { |
| 3 | + // Apply the java-library plugin for API and implementation separation. |
| 4 | + id 'java-library' |
| 5 | + id 'maven-publish' |
| 6 | + id 'signing' |
| 7 | + id 'cl.franciscosolis.sonatype-central-upload' version '1.0.0' |
| 8 | +} |
| 9 | + |
| 10 | +compileJava.options.encoding = "UTF-8" |
| 11 | +compileTestJava.options.encoding = "UTF-8" |
| 12 | + |
| 13 | +repositories { |
| 14 | + // Use Maven Central for resolving dependencies. |
| 15 | + mavenCentral() |
| 16 | +} |
| 17 | +java { |
| 18 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 19 | + targetCompatibility = JavaVersion.VERSION_11 |
| 20 | + withSourcesJar() |
| 21 | + withJavadocJar() |
| 22 | +} |
| 23 | + |
| 24 | +model { |
| 25 | + tasks.generatePomFileForMavenPublication { |
| 26 | + destination = file("$buildDir/pom.xml") |
| 27 | + } |
| 28 | +} |
| 29 | + |
| 30 | +jar { |
| 31 | + dependsOn(":generatePomFileForMavenPublication") |
| 32 | + archiveBaseName = "accounting" |
| 33 | + |
| 34 | + into("META-INF/maven/io.codat/accounting") { |
| 35 | + from("$buildDir/pom.xml") |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +javadoc { |
| 40 | + options.encoding = "UTF-8" |
| 41 | + |
| 42 | + if(JavaVersion.current().isJava9Compatible()) { |
| 43 | + options.addBooleanOption('html5', true) |
| 44 | + } |
| 45 | + options.addStringOption('Xdoclint:none', '-quiet') |
| 46 | +} |
| 47 | + |
| 48 | + |
| 49 | +tasks.withType(Javadoc) { |
| 50 | + failOnError false |
| 51 | + options.addStringOption('Xdoclint:none', '-quiet') |
| 52 | +} |
| 53 | +group = "io.codat" |
| 54 | +version = "0.1.0" |
| 55 | + |
| 56 | +sourcesJar { |
| 57 | + archiveBaseName = "accounting" |
| 58 | +} |
| 59 | + |
| 60 | +javadocJar { |
| 61 | + archiveBaseName = "accounting" |
| 62 | +} |
| 63 | + |
| 64 | +sonatypeCentralUpload { |
| 65 | + // This is your Sonatype generated username |
| 66 | + username = System.getenv("SONATYPE_USERNAME") |
| 67 | + // This is your sonatype generated password |
| 68 | + password = System.getenv("SONATYPE_PASSWORD") |
| 69 | + |
| 70 | + // This is a list of files to upload. Ideally you would point to your jar file, source and javadoc jar (required by central) |
| 71 | + archives = files( |
| 72 | + "$buildDir/libs/accounting-${version}.jar", |
| 73 | + "$buildDir/libs/accounting-${version}-sources.jar", |
| 74 | + "$buildDir/libs/accounting-${version}-javadoc.jar" |
| 75 | + ) |
| 76 | + |
| 77 | + // This is the pom file to upload. This is required by central |
| 78 | + pom = file("$buildDir/pom.xml") |
| 79 | + |
| 80 | + // This is your PGP private key. This is required to sign your files |
| 81 | + signingKey = System.getenv("SONATYPE_SIGNING_KEY") |
| 82 | + // This is your PGP private key passphrase to decrypt your private key |
| 83 | + signingKeyPassphrase = System.getenv("SIGNING_KEY_PASSPHRASE") |
| 84 | +} |
| 85 | +publishing { |
| 86 | + |
| 87 | + publications { |
| 88 | + maven(MavenPublication) { |
| 89 | + groupId = 'io.codat' |
| 90 | + artifactId = 'accounting' |
| 91 | + version = '0.1.0' |
| 92 | + |
| 93 | + from components.java |
| 94 | + |
| 95 | + pom { |
| 96 | + name = 'Codat Java SDK' |
| 97 | + description = 'SDK enabling Java developers to easily integrate with the Codat API.' |
| 98 | + url = 'https://github.com/codatio/client-sdk-java/previous-versions/accounting' |
| 99 | + scm { |
| 100 | + url = 'github.com/codatio/client-sdk-java/previous-versions/accounting' |
| 101 | + connection = 'scm:git:ssh://git@github.com/codatio/client-sdk-java/previous-versions/accounting.git' |
| 102 | + } |
| 103 | + licenses { |
| 104 | + license { |
| 105 | + name = 'The MIT License (MIT)' |
| 106 | + url = 'https://mit-license.org/' |
| 107 | + } |
| 108 | + } |
| 109 | + developers { |
| 110 | + developer { |
| 111 | + name = 'Codat' |
| 112 | + organization = 'Codat' |
| 113 | + email = 'support@codat.io' |
| 114 | + } |
| 115 | + } |
| 116 | + organization { |
| 117 | + name = 'Codat' |
| 118 | + url = 'https://www.codat.io/' |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + } |
| 123 | +} |
| 124 | + |
| 125 | +if (!project.hasProperty('skip.signing')) { |
| 126 | + signing { |
| 127 | + def signingKey = findProperty("signingKey") |
| 128 | + def signingPassphrase = findProperty("signingPassphrase") |
| 129 | + useInMemoryPgpKeys(signingKey, signingPassphrase) |
| 130 | + sign publishing.publications.maven |
| 131 | + } |
| 132 | +} |
| 133 | + |
| 134 | +dependencies { |
| 135 | + implementation 'com.fasterxml.jackson.core:jackson-databind:2.16.1' |
| 136 | + implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1' |
| 137 | + implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1' |
| 138 | + implementation 'org.openapitools:jackson-databind-nullable:0.2.6' |
| 139 | + implementation 'org.apache.httpcomponents:httpclient:4.5.14' |
| 140 | + implementation 'org.apache.httpcomponents:httpmime:4.5.14' |
| 141 | + implementation 'com.jayway.jsonpath:json-path:2.9.0' |
| 142 | + implementation 'commons-io:commons-io:2.15.1' |
| 143 | +} |
| 144 | + |
0 commit comments