I have a master directory build.gradle, and a module with another build.gradle that I’m trying to set up to publish to a maven repo. It cannot build, giving an error of Cause: invalid type code: B3
, ultimately because of org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException
on one of the parameters within the MavenPublication I’m trying to define.
If I view it in IntelliJ Idea, I can see that the parameters of the MavenPublication I’m trying to define are all marked as unresolved references.
Master directory build.gradle
:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
}
}
allprojects {
apply plugin: "idea"
group = 'com.mygroup'
version = '1.0.0'
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
And here’s the module’s build.gradle.
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'mylibrary'
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
signing {
sign publishing.publications.mavenJava
}
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
Any ideas of where I’ve gone wrong? I’m using Gradle 5.4.1.