我正在用gradle开发一个项目。我的构建文件到目前为止几乎是空的:Gradle项目中的Maven依赖关系
apply plugin: 'java'
apply plugin: 'eclipse'
version = '0.1'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.+'
}
我的项目依赖于Maven项目。正是这个项目:http://git.eclipse.org/c/bpmn2/tree/org.eclipse.bpmn2
我克隆了这个项目到我的工作区,但我不知道在我的build.gradle文件中声明依赖关系的最佳方式。这是我迄今为止所做的:
dependencies {
compile files ("C:/path/to/org.eclipse.bpmn2-0.7.0-SNAPSHOT.jar")
}
但是这样我就必须手动构建maven项目。有人知道做这种依赖管理的更好方法吗?
我使用Eclipse Gradle Integration和我注意到一个有趣的Eclipse项目性质:
Gradle - Dependency Management
[x] Remap Jars to maven projects (requires Gradle 1.1 and m2e)
这似乎做什么,我需要。但我不知道如何使用此功能...
在此先感谢。
请注意Kris在那里的评论,特别是:*“...对于要使用的功能,您必须至少将一次jar发布到某个maven回购站。”*我拉着头发,想知道为什么当地的工作空间分辨率没有没有工作,直到我读到。一旦我发布了maven项目1次到我的本地仓库,那么Gradle就能够解决我工作区中的副本。 –