I thought that I understand how gradle works, but here I got an issue that made me think I was wrong:
I have a GitHub project that I’ve migrated from Maven to Gradle. It used to have the simplest build.gradle so when I run gradle clean build
everything was great. But I want to push this project’s artifacts to Nexus using OSSRH, so I had to add some things that are related to “uploadArtifacts” to my build.gradle. Since then, everytime that I try (or Travis CI tries) to clean build, I get an error
Unable to retrieve secret key from key ring file ‘/home/travis/build/OhadR/oAuth2-sample/auth-common/PathToYourKeyRingFile’ as it does not exist
which I assume related to the “signing” plugin ( I have a gradle.properties file with “signing.secretKeyRingFile=PathToYourKeyRingFile”. but why it tries to activate the plugin? I only asked for a simple build…
what makes gradle run the signing plugin?
In addition, I see that Gradle runs the javadoc. Why? I thought that in order to run javadoc, I have to write explicitly “gradle javadoc
”…
thanks
ohad
my build.gradle file:
description = ‘parent POM for authentication projects’
subprojects {
apply plugin: ‘java’
apply plugin: ‘eclipse’
apply plugin: ‘maven’
apply plugin: ‘signing’
group = 'com.ohadr'
version = '2.0.0-SNAPSHOT'
eclipse {
classpath {
downloadSources=true
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
repositories {
mavenLocal()
mavenCentral()
}
ext {
ohadr_spring_security_version = "4.0.3.RELEASE"
ohadr_spring_version = "4.2.4.RELEASE"
ohadr_spring_security_oauth_version = "2.0.9.RELEASE"
}
jar {
//in case we wanna add the sources (.java) files to the artifacts, along with the .class files:
// from sourceSets.main.allSource
manifest {
attributes(
'provider': 'gradle',
'Product-Version': version,
)
}
}
uploadArchives {
repositories {
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 'Example Application'
packaging 'jar'
// optionally artifactId can be defined here
description 'A application used as an example on how to set up pushing its components to the Central Repository.'
url 'http://www.example.com/example-application'
scm {
connection 'scm:svn:http://foo.googlecode.com/svn/trunk/'
developerConnection 'scm:svn:https://foo.googlecode.com/svn/trunk/'
url 'http://foo.googlecode.com/svn/trunk/'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'manfred'
name 'Manfred Moser'
email 'manfred@sonatype.com'
}
}
}
}
}
}
}