无法在使用Gradle和Spring Boot时发布到本地Maven回购 [英] Unable to publish to local maven repo when using Gradle and Spring Boot

查看:224
本文介绍了无法在使用Gradle和Spring Boot时发布到本地Maven回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的spring-boot(1.0.2)示例(基于 http: //spring.io/guides/gs/rest-service/ )使用Gradle(1.12)创建一个jar文件。

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.

我试图使用maven或maven-publish gradle插件构建并发布到本地maven repo,但遇到了错误:

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:


无法初始化POM pom-default.xml:无法验证项目的POM ngdc.sample:/ Users / jcc / Documents / stash / hello中的hello-springboot -springboot / build / poms / pom-default.xml

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

不明白为什么。版本,组和archivesBaseName都在build.gradle中指定。一个类似的项目,不依赖于SpringBoot工作正常。

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?

感谢!

- john

推荐答案

以确保父pom或依赖关系管理也被指定(取决于你的配置,但是如果你使用的是Spring Boot Gradle插件,你可能需要它)。示例: https://github.com/spring-projects/spring-boot/blob/master/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/ resources / installer.gradle

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}"
          }
        }
    }
}

这篇关于无法在使用Gradle和Spring Boot时发布到本地Maven回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆