I have a very simple spring-boot (1.0.2) example (based on http://spring.io/guides/gs/rest-service/) using Gradle (1.12) to create a jar file.
I'm trying to build and publish to my local maven repo using either the maven or maven-publish gradle plugins but am getting the error:
Unable to initialize POM pom-default.xml: Failed to validate POM for project ngdc.sample:hello-springboot at /Users/jcc/Documents/stash/hello-springboot/build/poms/pom-default.xml
and don't understand why. version, group, and archivesBaseName are all specified in the build.gradle. A similar project which doesn't rely on SpringBoot works fine.
Can someone suggest what the problem might be?
Thanks!
--john
Gradle can consume dependencies available in the local Maven repository. Declaring this repository is beneficial for teams that publish to the local Maven repository with one project and consume the artifacts by Gradle in another project. Gradle stores resolved dependencies in its own cache.
You might need to ensure that the parent pom or dependency management is specified as well (depends on your configuration, but if you are using the Spring Boot Gradle plugin you probably do need it). Example here: https://github.com/spring-projects/spring-boot/blob/master/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/installer.gradle
install {
repositories.mavenInstaller {
pom.project {
parent {
groupId 'org.springframework.boot'
artifactId 'spring-boot-starter-parent'
version "${project.bootVersion}"
}
}
}
}
When the Spring Boot Gradle Plugin without dependency versions in the dependency{...}
section, the pom is generated without version for Spring Boot etc.
So at the moment it's required to create the relation to the parent pom by yourself for all maven realted tasks
parent {
groupId 'org.springframework.boot'
artifactId 'spring-boot-starter-parent'
version "${project.bootVersion}"
}
See https://github.com/spring-projects/spring-boot/issues/1716
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With