gradle - 带有 Artifactory 的spring依赖管理gradle插件

标签 gradle spring-boot artifactory spring-io

我正在尝试使用私有(private) Artifactory gradle repo 启动并运行一个新项目。我能够通过 Artifactory 来解决 Artifactory ,但是当我尝试将 spring io & boot 混合在一起时,spring 依赖管理插件在请求依赖时似乎没有添加版本,导致构建失败:

    FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-data-rest:.
  Searched in the following locations:
      https://my-website.com/artifactory/gradle-release/org/springframework/boot/spring-boot-starter-data-rest//spring-boot-starter-data-rest-.pom
      https://my-website.com/artifactory/gradle-release/org/springframework/boot/spring-boot-starter-data-rest//spring-boot-starter-data-rest-.jar
      https://my-website.com/artifactory/gradle-release/org.springframework.boot/spring-boot-starter-data-rest/ivy-.xml
      https://my-website.com/artifactory/gradle-release/org.springframework.boot/spring-boot-starter-data-rest//spring-boot-starter-data-rest-.jar

我可以在 https://my-website.com/artifactory/gradle-release/org/springframework/boot/spring-boot-starter-data-rest/1.5.3.RELEASE/ 看到文件但看起来“1.5.3.RELEASE”没有进入 URL 路径或文件名。

我猜我的问题出在我的构建脚本中 - 有人可以帮我找出问题吗?

构建.gradle:
plugins {
    id 'java'
    id 'io.spring.dependency-management' version '1.0.3.RELEASE'
    id 'org.springframework.boot' version '1.5.3.RELEASE'
    id 'com.jfrog.artifactory' version '4.4.18'
}

dependencyManagement {
    imports {
        mavenBom 'io.spring.platform:platform-bom:Brussels-SR2'
    }
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"
    publish {
        repository {
            repoKey = 'gradle-release-local'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
    }
    resolve {
        repository {
            repoKey = 'gradle-release'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
    }
}

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-data-rest'
    compile 'org.springframework.boot:spring-boot-starter-hateoas'
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'org.apache.commons:commons-lang3'

    testCompile'org.springframework.boot:spring-boot-starter-test'
    testCompile'org.springframework.restdocs:spring-restdocs-mockmvc'
}

最佳答案

想通了 - 看起来我的构建脚本没有问题 - 这是我的人工安全设置。

为了通过 Artifactory 解决依赖关系,需要为远程存储库启用部署/缓存(我认为不需要这样做,因为我不打算将任何东西部署到 mavencentral); Artifactory 试图缓存我为 spring 添加的新依赖项导致构建失败)。来源:https://www.jfrog.com/knowledge-base/what-are-best-practices-for-using-permissions/

希望这对其他人有所帮助,我已经浪费了一天的时间了:)

关于gradle - 带有 Artifactory 的spring依赖管理gradle插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44533666/

相关文章:

java - 如何在 Gradle 构建脚本中更改 java 源目录

java.security.NoSuchAlgorithmException : Cannot find any provider supporting RSA/NONE/PKCS1Padding in jar-file

android - 使用 Gradle 从 Artifactory 访问依赖项

gradle - 通过 gradle 将 zip(自定义 gradle 包装器)上传到 artifactory

gradle - TeamCity发布构建信息

Gradle publishToMavenLocal 不会将 jar 复制到本地 Maven 存储库

android - Gradle android 优化 packagingOptions

Spring Boot 嵌入式 Tomcat 未在 ApplicationListener 中加载外部属性文件

spring-boot - 从命令行参数覆盖 Spring 中的应用程序属性值

java - 在 spring boot 中使用 spring security 加盐密码的最佳做法是什么?