1

给定一个带有插件的 gradle 构建脚本warmaveneclipse-wtp.

gradle eclipseWtporg.eclipse.wst.common.component使用无法提交到源代码存储库的绝对路径进行条目,因为它们是用户特定的 - 请参阅<dependent-module>元素,更具体地说是handle属性:

[...]
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/C:/Users/mp/.m2/repository/ognl/ognl/3.0.6/ognl-3.0.6.jar">
    <dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/C:/Users/mp/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar">
    <dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/C:/Users/mp/.gradle/caches/artifacts-24/filestore/org.springframework/spring-context-support/3.2.4.RELEASE/jar/bcb2341e76ef4621f2422b1f066fb34c42fad08d/spring-context-support-3.2.4.RELEASE.jar">
    <dependency-type>uses</dependency-type>
</dependent-module>
[...]

Gradle 如何提供对提交更友好的路径,例如通过使用 M2_REPO 变量?

4

1 回答 1

0

如 Gradle 文档中所述(请参阅http://www.gradle.org/docs/current/dsl/org.gradle.plugins.ide.eclipse.model.EclipseClasspath.html),您可以指定路径变量:

eclipse {
  // if you want parts of paths in resulting file to be replaced by variables (files):
  pathVariables 'M2_REPO': file('C:/Users/mp/.m2/repository')
}

该变量必须在 Eclipse 中通过“Preferences -> Java -> Build Path -> Classpath Variables”进行设置,并且适用.classpath.settings/org.eclipse.wst.common.component

于 2014-12-13T18:17:23.770 回答