Я использую плагин maven-publi sh в Gradle для публикации sh моего приложения Spring Boot. Я запускаю обычное задание: ./gradlew artifactorypublish
. Однако появилась следующая ошибка, в которой я понял значение:
> Task :assembleArtifact
> Task :application-jar:compileJava UP-TO-DATE
> Task :application-jar:processResources UP-TO-DATE
> Task :application-jar:classes UP-TO-DATE
> Task :application-jar:jar SKIPPED
> Task :generateMetadataFileForMavenJavaPublication FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generateMetadataFileForMavenJavaPublication'.
> Invalid publication 'mavenJava':
- Publication only contains dependencies and/or constraints without a version. You need to add minimal version information, publish resolved versions (https://docs.gradle.org/6.1/userguide/publishing_maven.html#publishing_maven:resolved_dependencies) or reference a platform (https://docs.gradle.org/6.1/userguide/platforms.html)
Мой build.gradle:
plugins {
id 'org.springframework.boot' version '2.2.6.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'maven-publish'
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
publishing {
publications {
mavenJava(MavenPublication){
components.java
}
}
}
...
Версии:
Gradle 6.1
Spring Boot 2.2.6 (в основном генерируется из Spring Boot Initializr)