diff --git a/.circleci/config.yml b/.circleci/config.yml index ffb261255..58425046b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,17 +53,14 @@ jobs: - attach_workspace: at: ~/ - run: - name: Deploy snapshot to Artifactory - command: ./gradlew -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PartifactoryUrl=$ARTIFACTORY_URL -PartifactoryRepository=$SNAPSHOT_ARTIFACTORY_REPOSITORY -PartifactoryUsername=$ARTIFACTORY_USERNAME -PartifactoryPassword=$ARTIFACTORY_PASSWORD --info --stacktrace artifactoryPublish + name: Deploy snapshot to sonatype + command: echo "CircleCI publishing not implemented yet." deploy_release: executor: openjdk_executor working_directory: /home/circleci/mms steps: - attach_workspace: at: ~/ - - run: - name: Deploy release to Artifactory - command: ./gradlew -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PartifactoryUrl=$ARTIFACTORY_URL -PartifactoryRepository=$RELEASE_ARTIFACTORY_REPOSITORY -PartifactoryUsername=$ARTIFACTORY_USERNAME -PartifactoryPassword=$ARTIFACTORY_PASSWORD --info --stacktrace artifactoryPublish - run: name: Deploy release to Bintray command: ./gradlew -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PbintrayUser=$BINTRAY_USER -PbintrayKey=$BINTRAY_KEY --info --stacktrace bintrayUpload diff --git a/Dockerfile b/Dockerfile index 9d3830627..c1ee92baa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ COPY . /mms WORKDIR /mms RUN ./gradlew --no-daemon bootJar -RUN cp /mms/example/build/libs/example*.jar /app.jar +RUN find . -type f -name example-*.jar -not -iname '*javadoc*' -not -iname '*sources*' -exec cp '{}' '/app.jar' ';' ENV JDK_JAVA_OPTIONS "-XX:MaxRAMPercentage=90.0" ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "-jar", "/app.jar"] EXPOSE 8080 diff --git a/build.gradle b/build.gradle index 779f1045a..580eba809 100644 --- a/build.gradle +++ b/build.gradle @@ -59,19 +59,34 @@ subprojects { project.sourceCompatibility = '10' project.targetCompatibility = '10' } - version = rootProject.version apply plugin: 'java-library' apply plugin: 'maven-publish' apply plugin: 'io.spring.dependency-management' apply plugin: "com.jfrog.artifactory" apply plugin: 'com.jfrog.bintray' + apply plugin: 'maven' + apply plugin: 'signing' + + group = "org.openmbee.mms" + archivesBaseName = project.name + version = rootProject.version Map commonDependencies = rootProject.ext.commonDependencies + task javadocJar(type: Jar) { + archiveClassifier = "javadoc" + from javadoc + } + + task sourcesJar(type: Jar) { + archiveClassifier = "sources" + from sourceSets.main.allSource + } + java { - //withJavadocJar() - //withSourcesJar() + withJavadocJar() + withSourcesJar() } javadoc { @@ -79,6 +94,17 @@ subprojects { options.addBooleanOption('html5', true) } } + + artifacts { + archives javadocJar, sourcesJar + } + + signing { + if (project.hasProperty('signing.keyId') && project.hasProperty('signing.password') && project.hasProperty('signing.secretKeyRingFile')) { + sign configurations.archives + } + } + //https://docs.gradle.org/current/userguide/publishing_maven.html publishing { publications { @@ -131,4 +157,61 @@ subprojects { vcsUrl = 'https://github.com/Open-MBEE/mms.git' } } + + uploadArchives { + repositories { + if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) { + 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 { + name project.name + packaging 'jar' + // optionally artifactId can be defined here + description project.description + url 'http://github.com/OpenMBEE/mms' + + scm { + connection 'scm:git:https://github.com/Open-MBEE/mms.git' + developerConnection 'scm:git:https://github.com/Open-MBEE/mms.git' + url 'https://github.com/Open-MBEE/mms.git' + } + + licenses { + license { + name 'The Apache License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + + developers { + developer { + id 'huijun' + name 'Jason Han' + } + developer { + id 'dlam' + name 'Doris Lam' + } + developer { + id 'ward' + name 'Ward Schweitzer' + } + } + } + } + } + } + } +} +project('example') { + uploadArchives.enabled = false } \ No newline at end of file