Last active
July 12, 2021 19:47
-
-
Save rjrudin/28898afaf0a0aa6772aeaac1ae890e6a to your computer and use it in GitHub Desktop.
Bare minimum build.gradle file for publishing to Maven Central
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In addition to what's in this file, you'll need to define the following properties in your | |
// gradle.properties file: | |
// | |
// mavenCentralUsername= | |
// mavenCentralPassword= | |
// mavenCentralUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ | |
// | |
// In order for the "signing" plugin to work correctly, you'll also need to define the following properties, either | |
// in your gradle.properties file or at runtime: | |
// | |
// signing.keyId=YourKeyId | |
// signing.password=YourPublicKeyPassword | |
// signing.secretKeyRingFile=PathToYourKeyRingFile | |
// | |
plugins { | |
id "java-library" | |
id "maven-publish" | |
id "signing" | |
} | |
group = "com.marklogic" | |
version = "4.2.0" | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
// Add any dependencies that your project has here | |
} | |
task sourcesJar(type: Jar, dependsOn: classes) { | |
classifier 'sources' | |
from sourceSets.main.allSource | |
} | |
task javadocJar(type: Jar, dependsOn: javadoc) { | |
classifier "javadoc" | |
from javadoc | |
} | |
javadoc.failOnError = false | |
artifacts { | |
archives javadocJar, sourcesJar | |
} | |
signing { | |
sign configurations.archives | |
} | |
publishing { | |
publications { | |
mainJava(MavenPublication) { | |
pom { | |
name = "${group}:${project.name}" | |
description = "CHANGEME Provide a description of your project here" | |
packaging = "jar" | |
url = "https://github.com/marklogic-community/${project.name}" | |
licenses { | |
license { | |
name = "The Apache License, Version 2.0" | |
url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | |
} | |
} | |
developers { | |
developer { | |
id = "marklogic" | |
name = "MarkLogic Github Contributors" | |
email = "[email protected]" | |
organization = "MarkLogic" | |
organizationUrl = "https://www.marklogic.com" | |
} | |
} | |
scm { | |
url = "[email protected]:marklogic-community/${project.name}.git" | |
connection = "scm:[email protected]:marklogic-community/${project.name}.git" | |
developerConnection = "scm:[email protected]:marklogic-community/${project.name}.git" | |
} | |
} | |
from components.java | |
artifact sourcesJar | |
artifact javadocJar | |
} | |
} | |
repositories { | |
maven { | |
name = "central" | |
url = mavenCentralUrl | |
credentials { | |
username mavenCentralUsername | |
password mavenCentralPassword | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment