plugins { id 'java-library' id 'maven-publish' id 'signing' } ext.isSnapshotVersion = version.endsWith("SNAPSHOT") ext.isReleaseVersion = !ext.isSnapshotVersion sourceCompatibility = 11 targetCompatibility = 11 repositories { mavenCentral() } dependencies { testImplementation 'junit:junit:4.13.2' } jar { manifest { attributes( 'Implementation-Title': 'B/BAS Tools API', 'Implementation-Version': "${project.version} (${new Date().format('yyyy-MM-dd HH:mm')})" ) } } javadoc { title = "bastools ${version}" source = sourceSets.main.allJava options.addStringOption('Xdoclint:none', '-quiet') } task javadocJar(type: Jar) { archiveClassifier = 'javadoc' from javadoc } task sourcesJar(type: Jar) { archiveClassifier = 'sources' from sourceSets.main.allSource } publishing { publications { mavenJava(MavenPublication) { from components.java artifact sourcesJar artifact javadocJar pom { groupId = "net.sf.applecommander" artifactId = archivesBaseName name = "B/BAS Tools (bastools)" description = 'An Applesoft BASIC tools library.' url = 'https://applecommander.github.io/' licenses { license { name = 'The GNU General Public License (GPL) Version 3, 29 June 2007' url = 'https://www.gnu.org/licenses/gpl-3.0.html' } } developers { developer { id = 'robgreene' name = 'Rob Greene' email = 'robgreene@gmail.com' } } scm { connection = 'scm:git:https://github.com/AppleCommander/bastools.git' developerConnection = 'scm:git:git@github.com:AppleCommander/bastools.git' url = 'https://github.com/AppleCommander/bastools' } } repositories { maven { def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2" def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" url = isSnapshotVersion ? snapshotsRepoUrl : releasesRepoUrl credentials { username = findProperty('ossrhUsername') password = findProperty('ossrhPassword') } } } } } } signing { sign publishing.publications.mavenJava }