Gradle在下载工件时未正确解析版本
我正试图从本地artifactory实例中提取依赖项。依赖项是我拥有的另一个项目(org.myproject),它有几个spring引导依赖项 以下是gradle的失败:Gradle在下载工件时未正确解析版本,gradle,artifactory,Gradle,Artifactory,我正试图从本地artifactory实例中提取依赖项。依赖项是我拥有的另一个项目(org.myproject),它有几个spring引导依赖项 以下是gradle的失败: FAILURE: Build failed with an exception * What went wrong: Could not resolve all dependencies for configuration ':compile'. > Could not resolve org.myproject.xx
FAILURE: Build failed with an exception
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not resolve org.myproject.xxx:yyy:0.0.1-SNAPSHOT.
Required by:
:localproject:unspecified
> Could not resolve org.myproject.xxx:yyy:0.0.1-SNAPSHOT.
> Could not parse POM http://10.x.x.x:8081/artifactory/path/to/artifact.pom
> Unable to resolve version for dependency 'org.springframework.boot:spring-boot-starter-aop:jar'
当我运行gradlew dependencies时,当它试图确定项目的所有依赖项及其关联版本时失败
我看到有人四处搜索,过去也有人抱怨过这一点,但他们相关的bug似乎已经解决了。我已经试用了最新的gradle版本2.3/2.4,但仍然不起作用
上载的org.myproject的artifactory插件生成的pom没有任何版本与spring引导依赖项明确关联
有人知道这里会发生什么吗
编辑-为org.myproject添加MY build.gradle
buildscript {
ext {
springBootVersion = '1.2.4.RELEASE'
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
classpath 'com.h2database:h2:1.3.170'
classpath 'org.flywaydb:flyway-gradle-plugin:3.2.1'
}
}
plugins {
id "com.jfrog.artifactory" version "3.1.1"
}
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
apply plugin: 'org.flywaydb.flyway'
apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"
allprojects {
apply plugin: "com.jfrog.artifactory"
}
group = 'org.myproject.xxx'
version = '0.0.1-SNAPSHOT'
def publishRepoKey = 'libs-snapshot-local'
war {
baseName = "vsis-core"
version = "${version}"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
mavenLocal()
}
configurations {
providedRuntime
}
flyway {
url = 'jdbc:h2:file:target/defaultDB'
user = 'sa'
}
dependencies {
def jaxenVersion = '1.1.6'
compile "jaxen:jaxen:${jaxenVersion}"
def apacheCommonsMath3 = '3.4.1'
compile "org.apache.commons:commons-math3:${apacheCommonsMath3}"
compile "org.springframework.retry:spring-retry:1.1.2.RELEASE"
compile "org.springframework.boot:spring-boot-starter-aop"
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-security"
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
// dao libs
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile("org.hibernate:hibernate-ehcache")
compile("org.flywaydb:flyway-core")
def springSecurityVersion = '4.0.1.RELEASE'
compile "org.springframework.security:spring-security-core:${springSecurityVersion}"
compile "org.springframework.security:spring-security-web:${springSecurityVersion}"
compile "org.springframework.security:spring-security-config:${springSecurityVersion}"
compile "org.springframework.security:spring-security-taglibs:${springSecurityVersion}"
compile 'org.springframework.security.extensions:spring-security-saml2-core:1.0.1.RELEASE'
providedRuntime 'commons-io:commons-io:1.4'
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'org.easymock:easymock:3.3.1'
testCompile("org.hsqldb:hsqldb")
}
compileJava {
options.compilerArgs << '-parameters'
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
downloadSources = true
downloadJavadoc = true
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
publishing {
publications {
main(MavenPublication) {
from components.java
artifact sourcesJar
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
resolve {
repository {
repoKey = 'libs-release'
}
}
publish {
repository {
repoKey = "${publishRepoKey}"
username = "${artifactory_user}"
password = "${artifactory_password}"
}
defaults {
publications 'main'
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
buildscript{
分机{
springBootVersion='1.2.4.RELEASE'
}
存储库{
mavenCentral()
mavenLocal()
jcenter()
}
依赖关系{
类路径(“org.springframework.boot:spring-boot-gradle插件:${springBootVersion}”)
//请在此处查看最新版本:http://plugins.gradle.org/plugin/com.jfrog.artifactory
类路径“org.jfrog.buildinfo:buildinfo提取器gradle:3.1.1”
类路径'com.h2数据库:h2:1.3.170'
classpath'org.flywaydb:flywaygradle插件:3.2.1'
}
}
插件{
id“com.jfrog.artifactory”版本“3.1.1”
}
应用插件:“java”
应用插件:“EclipseWTP”
应用插件:“创意”
应用插件:“spring boot”
应用插件:“战争”
应用插件:“org.flywaydb.flyway”
应用插件:“maven发布”
应用插件:“com.jfrog.artifactory”
所有项目{
应用插件:“com.jfrog.artifactory”
}
组='org.myproject.xxx'
版本='0.0.1-SNAPSHOT'
def publishRepoKey='libs快照本地'
战争{
baseName=“vsis核心”
version=“${version}”
}
sourceCompatibility=1.8
targetCompatibility=1.8
存储库{
mavenCentral()
mavenLocal()
}
配置{
提供的运行时
}
飞行路线{
url='jdbc:h2:file:target/defaultDB'
用户='sa'
}
依赖关系{
def jaxenVersion='1.1.6'
编译“jaxen:jaxen:${jaxenVersion}”
def apacheCommonsMath3='3.4.1'
编译“org.apache.commons:commons-math3:${apachecommonmath3}”
编译“org.springframework.retry:spring retry:1.1.2.RELEASE”
编译“org.springframework.boot:springbootstarteraop”
编译“org.springframework.boot:springbootstarterweb”
编译“org.springframework.boot:springbootstartersecurity”
编译“org.springframework.boot:springbootstartermyleaf”
//刀库
编译(“org.springframework.boot:springbootstarterdatajpa”)
编译(“org.springframework.boot:springbootstarterdatarest”)
编译(“org.hibernate:hibernateehcache”)
编译(“org.flywaydb:flywaycore”)
def springSecurityVersion='4.0.1.RELEASE'
编译“org.springframework.security:spring安全核心:${springSecurityVersion}”
编译“org.springframework.security:springsecurityweb:${springSecurityVersion}”
编译“org.springframework.security:spring安全配置:${springSecurityVersion}”
编译“org.springframework.security:springsecurity标记库:${springSecurityVersion}”
编译“org.springframework.security.extensions:spring-security-saml2-core:1.0.1.RELEASE”
提供的运行时“commons io:commons io:1.4”
testCompile“org.springframework.boot:springbootstarter测试”
testCompile'org.mockito:mockito all:1.9.5'
testCompile'org.easymock:easymock:3.3.1'
testCompile(“org.hsqldb:hsqldb”)
}
内贾瓦{
options.compilerArgs尝试下载http://10.x.x.x:8081/artifactory/path/to/artifact.pom
从您的浏览器下载。它会下载吗?里面有什么?它是有效的pom文件吗?是的,它是有效的。我已经下载并检查了它。我只是重新查看了gradle dependencies输出,但它实际上没有解析pom中的所有依赖项。那么,artifactory插件如何从我的gradle依赖项组装pom可能会有问题吗?您是否定义了ResolutionsStrategy?如果有,请尝试删除它并查看是否存在配置问题。您还可以刷新缓存并查看调试日志以获得任何提示。没有ResolutionsStrategy,这一切都很普通。我只是编辑了它我的帖子是为上传到artifactory的项目添加build.gradle。我删除了一些依赖项,但这很重要。pom似乎没有列出spring启动依赖项的版本。请检查一下。尝试下载http://10.x.x.x:8081/artifactory/path/to/artifact.pom
从您的浏览器。它会自动关闭吗ownload?里面有什么?它是一个有效的pom文件吗?是的,它是有效的。我已经下载并检查了它。我只是重新检查了gradle依赖项输出,但它实际上没有解决pom中的所有依赖项。那么,可能是artifactory插件如何从我的gradle依赖项组装pom的问题吗?你有解决方案吗定义了策略?如果是,请尝试删除它并查看是否存在配置问题。您还可以刷新缓存并查看调试日志以获取任何提示。没有解决策略,这一切都很普通。我刚刚编辑了我的帖子,为上载到artifactory的项目添加build.gradle。我删除了一些依赖项,但这是预先设置的看起来pom没有列出spring启动依赖项的版本。请检查。