简体   繁体   English

春天的依赖管理gradle插件与人工

[英]spring dependency-management gradle plugin with artifactory

I'm trying to get a new project up and running using a private artifactory gradle repo. 我正在尝试使用私有人工gradle存储库启动并运行一个新项目。 I was able to get it resolving artifacts through artifactory, but when I try to throw spring io & boot into the mix, the spring dependency management plugin doesn't seem to add the version when requesting the dependency, causing the build to fail: 我能够通过工件来解决工件问题,但是当我尝试将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

I can see the files at https://my-website.com/artifactory/gradle-release/org/springframework/boot/spring-boot-starter-data-rest/1.5.3.RELEASE/ but looks like the "1.5.3.RELEASE" isn't making it to the URL path or filename. 我可以在https://my-website.com/artifactory/gradle-release/org/springframework/boot/spring-boot-starter-data-rest/1.5.3.RELEASE/中看到文件,但看起来像“ 1.5 .3.RELEASE”未指向URL路径或文件名。

I'm guessing my problem is in my build script - can someone please help me identify the issue? 我猜我的问题出在我的构建脚本中-有人可以帮我确定问题吗?

build.gradle: 的build.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'
}

Figured it out - looks like there was no problem with my build script - it was my artifactory security settings. 弄清楚了-看起来我的构建脚本没有问题-这是我的工件安全设置。

In order to resolve dependencies through artifactory, deploy/cache needs to be enabled for remote repositories (which I didn't think was needed since I wasn't planning on deploying anything to mavencentral); 为了通过工件解决依赖关系,需要为远程存储库启用部署/缓存(由于我不打算将任何内容部署到mavencentral,所以我认为这是不需要的)。 Artifactory trying to cache the new dependencies I added for spring was causing the build to fail). Artifactory尝试缓存我为spring添加的新依赖项导致构建失败)。 Source: https://www.jfrog.com/knowledge-base/what-are-best-practices-for-using-permissions/ 资料来源: https : //www.jfrog.com/knowledge-base/what-are-best-practices-for-using-permissions/

Hope this helps someone else, I've wasted enough time on it for one day :) 希望这对其他人有帮助,我已经花了足够的时间一天:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 spring依赖管理gradle插件不下载依赖 - spring dependency-management gradle plugin doesn't download dependency Gradle:在Spring Boot依赖管理插件中访问版本声明 - Gradle: Access version declaration in spring boot dependency-management plugin Gradle spring 依赖管理插件和发布库 - Gradle spring dependency management plugin and publishing the library Gradle中的自定义依赖关系管理插件 - Custom dependency management plugin in Gradle 使用Gradle 5.1“实现平台”而不是Spring Dependency Management Plugin - Using Gradle 5.1 “implementation platform” instead of Spring Dependency Management Plugin Gradle 包装器更新和 spring.dependency-management 插件错误 - Gradle Wrapper Update and spring.dependency-management Plugin Error Gradle项目共享人工插件依赖 - Gradle projects sharing artifactory plugin dependency Gradle Spring 依赖管理未解决 - Gradle Spring dependency management not resolving 无法使用Spring Boot Gradle插件通过依赖项管理执行junit5测试 - Failed to execute junit5 tests with dependency management with spring boot gradle plugin 是否可以使用 Spring 的 Gradle 依赖管理插件设置依赖项的分类器 - Is it possible to set a dependencySet entry's classifier using Spring's Gradle dependency management plugin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM