I have a java with gradle (5.2) project and I'm trying to publish it to myMavenRepo
My build.gradle
plugins {
id 'maven-publish'
id 'java'
id 'org.springframework.boot' version '2.2.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
}
group = 'com.doe'
version = '1.0.0'
sourceCompatibility = 10
targetCompatibility = 10
repositories {
mavenCentral()
maven { url MY_MAVEN_REPO_READ_URL }
}
dependencies { ... }
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
publishing {
repositories {
maven {
url MY_MAVEN_REPO_WRITE_URL
}
}
publications {
maven(MavenPublication) {
from components.java
artifact sourceJar {
classifier "sources"
}
}
}
}
but I always receive this error:
Invalid publication 'maven': artifact file does not exist: '/build/libs/project-1.0.0.jar'
And the .jar is always created with this name: project-1.0.0-sources.jar
So I tried to remove that 'sources' from the name changing classifier to empty:
artifact sourceJar {
classifier ""
}
But I received this error:
Invalid publication 'maven': multiple artifacts with the identical extension and classifier ('jar', 'null').
Could someone help me?