Pau*_*mer 4 gradle maven gradlew springfox
我正在尝试使用springfox项目做一些工作,该项目已分解为两个独立的项目:springfox 运行时和一套演示。
为了调查某些配置的行为,我需要更改 中的模块springfox/springfox-petstore,并将其编译为springfox-demos/springfox-java-swagger.
在 中springfox,我构建并发布了 的新版本springfox-petstore,并验证它在~/.m2/repository/io/springfox/springfox-petstore/2.2.2-SNAPSHOT.
接下来,在springfox-demos我添加mavenLocal()为存储库,并添加springfox-petstore-2.2.2-SNAPSHOT为changing=true依赖项。
当我尝试构建springfox-demos运行时时,出现以下错误:
* What went wrong:
A problem occurred configuring project ':spring-java-swagger'.
> Could not resolve all dependencies for configuration ':spring-java-swagger:runtimeCopy'.
> Could not find io.springfox:springfox-petstore:2.2.2-SNAPSHOT.
Searched in the following locations:
https://jcenter.bintray.com/io/springfox/springfox-petstore/2.2.2-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/io/springfox/springfox-petstore/2.2.2-SNAPSHOT/springfox-petstore-2.2.2-SNAPSHOT.pom
https://jcenter.bintray.com/io/springfox/springfox-petstore/2.2.2-SNAPSHOT/springfox-petstore-2.2.2-SNAPSHOT.jar
http://oss.jfrog.org/artifactory/oss-snapshot-local/io/springfox/springfox-petstore/2.2.2-SNAPSHOT/maven-metadata.xml
http://oss.jfrog.org/artifactory/oss-snapshot-local/io/springfox/springfox-petstore/2.2.2-SNAPSHOT/springfox-petstore-2.2.2-SNAPSHOT.pom
http://oss.jfrog.org/artifactory/oss-snapshot-local/io/springfox/springfox-petstore/2.2.2-SNAPSHOT/springfox-petstore-2.2.2-SNAPSHOT.jar
Required by:
springfox-demos:spring-java-swagger:unspecified
Run Code Online (Sandbox Code Playgroud)
我已经尝试了各种构建任务的组合,但我似乎无法让 Gradle 满足我使用带有 -SNAPSHOT 工件的本地 maven 存储库的请求。
这是顶级 build.gradle:
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath "com.github.adrianbk:gradle-jvmsrc-plugin:0.6.1"
classpath 'com.ofg:uptodate-gradle-plugin:1.6.0'
}
}
apply from: "$rootDir/gradle/dependencies.gradle"
subprojects {
apply plugin: 'com.github.adrianbk.jvmsrc'
jvmsrc {
packageName "springfoxdemo"
}
apply plugin: 'java'
apply plugin: 'com.ofg.uptodate'
repositories {
jcenter()
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
configurations.all {
//Dont cache snapshots
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
wrapper {
gradleVersion = "2.4"
}
Run Code Online (Sandbox Code Playgroud)
所以看起来顶层 build.gradle 可以有多个repositories{}块。我已经正确地添加了mavenLocal()一个,但错过了另一个。一旦添加mavenLocal()到第二个块,一切运行良好。
| 归档时间: |
|
| 查看次数: |
3785 次 |
| 最近记录: |