我正在使用 Eclipse Luna 和 Eclipse Luna 的 Gradle 插件(使用 Pivotal 的 Gradle IDE Pack 3.6.x)。我创建了一个支持 Gradle 的简单 Java 项目。在我的 build.gradle 下面
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'artifactory'
buildscript {
repositories {
maven { url 'http://dl.bintray.com/jfrog/jfrog-jars' }
mavenCentral()
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.2.4')
}
}
version = '1.0'
repositories {
maven { url 'http://maven.restlet.com' }
mavenCentral()
}
dependencies {
compile group: 'com.cloudit4', name: 'cit4-util-lib', version: '1.0'
compile group: 'org.restlet.gae', name: 'org.restlet', version: '2.3.2'
compile group: 'org.restlet.gae', name: 'org.restlet.ext.servlet', version: '2.3.2'
}
// Artifactory...
artifactory {
contextUrl = 'http://192.168.245.1:8081/artifactory' //The base Artifactory URL if not overridden by the publisher/resolver
publish {
contextUrl = 'http://192.168.245.1:8081/artifactory' //The base Artifactory URL for the publisher
//A closure defining publishing information
repository {
repoKey = 'libs-release-local' //The Artifactory repository key to publish to
username = 'admin' //The publisher user name
password = 'mypass' //The publisher password
}
}
resolve {
contextUrl = 'http://192.168.245.1:8081/artifactory' //The base Artifactory URL for the resolver
repository {
repoKey = 'repo' //The Artifactory (preferably virtual) repository key to resolve from
}
}
}
您可能会注意到,我使用 Artifactory 来托管我自己的工件(本地库,cit4-util-lib)。通常我处理使用 Google App Engine 库的项目,并且很多时候我使用 gradle 的 appengine 插件将它包含在 Gradle 中。但正如您所见,这一次并非如此。没有任何依赖项对 Google App Engine 库有依赖项。但是当我执行 Gradle 依赖项刷新时,我的依赖项中包含了一个 Google App Engine 库。有人见过这种行为吗?gradle 在哪里寻找要包含在项目中的库?仅仅是在 build.gradle 文件中明确设置的依赖项还是更多?