我正在嘗試做一些與springfox項目有關的工作,該項目已被分解爲兩個獨立的項目:springfox運行時和一套演示。如何配置Gradle以查找本地SNAPSHOT資源?
爲了研究某些配置的行爲,我需要更改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
我已經試過了各種的構建任務組合,但我似乎無法得到搖籃兌現我的要求用於使用帶有-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"
}
您可以從build.gradle文件中添加依賴項和存儲庫片段,以及您應用的gradle插件嗎?如果你還沒有添加'apply plugin:'maven''到文件中(我不記得是否將它添加到我的工作嘗試中,以允許mavenLocal()的存儲庫或相同的東西推送到我的本地maven文件) – romeara
http://stackoverflow.com/questions/8383521/how-to-configure-maven-local-and-remote-repository-in-gradle-build-file –