$ ./gradlew -version
------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_181 (Oracle Corporation 25.181-b13)
OS: Mac OS X 10.15.7 x86_64
I have a sub-project with the following build.gradle
file
plugins {
id 'java'
id 'maven-publish'
}
dependencies {
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.10'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.10'
compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
}
task sourcesJar(type: Jar, dependsOn: classes){
from sourceSets.main.allSource
}
artifacts{
archives sourcesJar
}
publishing {
repositories{
maven {
url 's3://' + s3_bucket
authentication {
awsIm(AwsImAuthentication)
}
}
}
publications {
integrationsCommon(MavenPublication){
artifactId artifactId
from components.java
artifact sourcesJar{
classifier "sources"
}
}
}
}
I can run
$ ./gradlew clean build pTML -p my-sub-project
...and see the artifact published in my ~/.m2
local repo.
But I get the following error when I run the publish
task
$ ./gradlew clean build publish -p my-sub-project
* What went wrong:
Execution failed for task ':my-sub-project:publishIntegrationsCommonPublicationToMaven2Repository'.
> Failed to publish publication 'integrationsCommon' to repository 'maven2'
> java.lang.NullPointerException (no error message)
Why is that? I was under the impression that if can publish to Maven local I can publish anywhere! (God I miss Maven!).
The AWS documentation suggest to define credentials
.
This just refers to CodeArtifact instead of S3, which appears to be the common back-end. If you want to use S3 instead... add --stacktrace
to the command, in order to determine what that NullPointerException
may be caused by; the configuration may lack something essential.
This would be the Gradle documentation for S3: AWS S3 repositories configuration .