| group = 'org.mockito' |
| |
| plugins.withId("java") { |
| //Sources/javadoc artifacts required by Maven module publications |
| def licenseSpec = copySpec { |
| from project.rootDir |
| include "LICENSE" |
| } |
| |
| def sourcesJarTask = tasks.register("sourcesJar", Jar) { |
| archiveClassifier = 'sources' |
| from sourceSets.main.allSource |
| with licenseSpec |
| } |
| |
| def javadocJarTask = tasks.register("javadocJar", Jar) { |
| archiveClassifier = 'javadoc' |
| from tasks.javadoc |
| with licenseSpec |
| } |
| |
| artifacts { |
| archives sourcesJarTask |
| archives javadocJarTask |
| } |
| |
| tasks.named("jar", Jar) { |
| with licenseSpec |
| } |
| } |
| |
| |
| tasks.withType(GenerateModuleMetadata).configureEach { |
| enabled = false |
| } |
| |
| //Gradle Maven publishing plugin configuration (https://docs.gradle.org/current/userguide/publishing_maven.html) |
| apply plugin: "maven-publish" |
| publishing { |
| publications { |
| javaLibrary(MavenPublication) { |
| plugins.withId("java") { |
| from components.java |
| artifact tasks.named("sourcesJar") |
| artifact tasks.named("javadocJar") |
| } |
| plugins.withId("java-platform") { |
| from components.javaPlatform |
| } |
| |
| artifactId = project.base.archivesName.get() |
| |
| pom { |
| name = artifactId |
| afterEvaluate { |
| description = project.description |
| } |
| |
| plugins.withId("java") { |
| //Gradle does not write 'jar' packaging to the pom (unlike other packaging types). |
| //This is OK because 'jar' is implicit/default: |
| // https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#minimal-pom |
| packaging = project.tasks.jar.archiveExtension.get() |
| } |
| |
| url = "https://github.com/mockito/mockito" |
| licenses { |
| license { |
| name = 'MIT' |
| url = 'https://opensource.org/licenses/MIT' |
| distribution = 'repo' |
| } |
| } |
| developers { |
| ['mockitoguy:Szczepan Faber', 'bric3:Brice Dutheil', 'raphw:Rafael Winterhalter', |
| 'TimvdLippe:Tim van der Lippe'].each { devData -> |
| developer { |
| def devInfo = devData.split(':') |
| id = devInfo[0] |
| name = devInfo[1] |
| url = 'https://github.com/' + devInfo[0] |
| roles = ["Core developer"] |
| } |
| } |
| } |
| scm { |
| url = 'https://github.com/mockito/mockito.git' |
| } |
| issueManagement { |
| url = 'https://github.com/mockito/mockito/issues' |
| system = 'GitHub issues' |
| } |
| ciManagement { |
| url = 'https://github.com/mockito/mockito/actions' |
| system = 'GH Actions' |
| } |
| } |
| } |
| } |
| |
| //useful for testing - running "publish" will create artifacts/pom in a local dir |
| repositories { maven { url = layout.buildDirectory.dir("repo") } } |
| } |
| |
| plugins.withId("java") { |
| //fleshes out problems with Maven pom generation when building |
| tasks.named("build") { |
| dependsOn("publishJavaLibraryPublicationToMavenLocal") |
| } |
| } |
| |
| apply plugin: 'signing' //https://docs.gradle.org/current/userguide/signing_plugin.html |
| signing { |
| if (System.getenv('PGP_KEY')) { |
| useInMemoryPgpKeys(System.getenv('PGP_KEY'), System.getenv('PGP_PWD')) |
| sign publishing.publications.javaLibrary |
| } |
| } |