diff --git a/build.gradle b/build.gradle index c2b57e2..e5629b8 100644 --- a/build.gradle +++ b/build.gradle @@ -4,11 +4,15 @@ apply plugin: 'org.sonarqube' apply plugin: 'maven-publish' apply plugin: "com.jfrog.artifactory" apply plugin: "com.github.hierynomus.license" +apply plugin: 'signing' +apply plugin: 'maven' //apply plugin: 'nebula.lint' sourceCompatibility = 1.8 version = "${version}" group = 'com.dell.isg.smi' +archivesBaseName = "wsmanclient" +ext.isReleaseVersion = !version.endsWith("SNAPSHOT") sourceSets { main { @@ -22,7 +26,7 @@ buildscript { repositories { mavenLocal() maven { - url "${artifactory_contextUrl}/libs-release" + url "${artifactory_contextUrl}/${plugin_repo}" url "https://plugins.gradle.org/m2/" } } @@ -35,6 +39,32 @@ buildscript { } } +if (JavaVersion.current().isJava8Compatible()) { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } +} + +javadoc { + options { + encoding = 'windows-1251' + } +} + +task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc +} + +artifacts { + archives javadocJar, sourcesJar +} + //gradleLint { //rules = ['dependency-parentheses','overridden-dependency-version','duplicate-dependency-class', 'all-dependency','unused-dependency'] //} @@ -56,13 +86,13 @@ jar { repositories { mavenLocal() maven { - url "${artifactory_contextUrl}/libs-release" + url "${artifactory_contextUrl}/${dependency_repo}" } } dependencies { compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' - compile 'com.dell.isg.smi:commons-elm:1.0.36' + compile 'com.dell.isg.smi:commons-elm:1.0.76' compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5' compile group: 'xerces', name: 'xercesImpl', version: '2.11.0' } @@ -76,6 +106,53 @@ uploadArchives { flatDir { dirs 'repos' } + + mavenDeployer + { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + pom.project { + artifactId = "wsmanclient" + packaging 'jar' + url 'https://www.github.com/rackhd/smi-lib-wsman-client' + name 'SMI Commons ELM' + description 'WSMAN Client jar library for the System Management Integration (SMI) projects.' + inceptionYear '2017' + + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' + } + } + + scm { + connection 'scm:git:git://www.github.com/rackhd/smi-lib-wsman-client.git' + developerConnection 'scm:git:ssh://www.github.com/rackhd/smi-lib-wsman-client.git' + url 'http://www.github.com/rackhd/smi-lib-wsman-client' + } + + developers { + developer { + id 'michaelsteven' + name 'Michael Hepfer' + email 'michael.hepfer@dell.com' + organization 'Dell EMC Inc.' + organizationUrl 'http://codedellemc.com' + } + } + + } + } } @@ -83,6 +160,10 @@ publishing { publications { mavenJava(MavenPublication){ artifact jar + artifact sourcesJar { + classifier "sources" + } + artifact javadocJar } } } @@ -101,7 +182,6 @@ artifactory { publish { defaults{ publications ("mavenJava")} repository { - repoKey = 'libs-release-local' // note: username and password being set by bamboo artifactory plugin maven = true } diff --git a/gradle.properties b/gradle.properties index 6d0cb09..52ca97e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,12 @@ -version=1.0 +version=1.0-SNAPSHOT artifactory_contextUrl=https://gtie-artifactory.us.dell.com/artifactory +plugin_repo=libs-release +dependency_repo=libs-snapshot buildInfo.licenseControl.runChecks=true buildInfo.licenseControl.autoDiscover=true buildInfo.build.name=com.dell.isg.smi:wsmanclient -systemProp.sonar.host.url=http://100.68.126.201:9000 \ No newline at end of file +systemProp.sonar.host.url=https://sonarqube.com +systemProp.sonar.organization=rackhd-smi +systemProp.sonar.login=##sonarqubeLogin-placeholder## +ossrhUsername=##ossrhUsername-placeholder## +ossrhPassword=##ossrhPassword-placeholder## \ No newline at end of file