All Downloads are FREE. Search and download functionalities are using the official Maven repository.

skeleton.build.gradle Maven / Gradle / Ivy

plugins {
@buildPlugins@
}

ext."signing.keyId" = project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : System.getenv('SIGNING_KEY')
ext."signing.password" = project.hasProperty("signing.password") ? project.getProperty('signing.password') : System.getenv('SIGNING_PASSPHRASE')
ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : ("${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg")
ext.isReleaseVersion = !projectVersion.endsWith("SNAPSHOT")

group "org.graceframework.profiles"
version projectVersion

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    implementation "org.apache.groovy:groovy:$groovyVersion"
    profile "org.graceframework.profiles:base:$baseVersion"
}

tasks.withType(Sign) {
   onlyIf { isReleaseVersion }
}

tasks.withType(GroovyCompile) {
    configure(groovyOptions) {
        forkOptions.jvmArgs = ['-Xmx1024m']
    }
}

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
    withJavadocJar()
    withSourcesJar()
}

jar {
    manifest.mainAttributes(
        "Built-By": System.properties['user.name'],
        "Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
        "Implementation-Title": "Grace Web Profile",
        "Implementation-Version": project.version,
        "Implementation-Vendor": 'graceframework.org')
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId = project.group
            artifactId = project.name
            version = project.version

            from components.java

            afterEvaluate {
                artifact source: "${project.buildDir}/classes/profile/META-INF/grails-profile/profile.yml",
                        classifier: 'profile',
                        extension: 'yml'
            }
            pom {
                name = "My Profile"
                description = "A profile for Web applications"
                url = 'https://github.com/grace-profiles/my-profile'
                licenses {
                    license {
                        name = 'The Apache License, Version 2.0'
                        url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id = 'rainboyan'
                        name = 'Michael Yan'
                        email = '[email protected]'
                    }
                }
                scm {
                    connection = 'scm:git:git://github.com/grace-profiles/my-profile.git'
                    developerConnection = 'scm:git:ssh://github.com:grace-profiles/my-profile.git'
                    url = 'https://github.com/grace-profiles/my-profile'
                }
            }
        }
    }
}

nexusPublishing {
    repositories {
        sonatype {
            def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
            def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
            def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : ''
            nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
            snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
            username = ossUser
            password = ossPass
            stagingProfileId = ossStagingProfileId
        }
    }
}

afterEvaluate {
    signing {
        required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
        sign publishing.publications.maven
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy