Eclipse Buildship一直在覆盖。类路径
我将Gradle和Eclipse与Buildship插件一起使用 Buildship创建供Eclipse使用的Eclipse Buildship一直在覆盖。类路径,eclipse,gradle,buildship,eclipse-classpath,Eclipse,Gradle,Buildship,Eclipse Classpath,我将Gradle和Eclipse与Buildship插件一起使用 Buildship创建供Eclipse使用的.classpath文件。我需要一个类路径条目(com.gwtplugins.gwt.eclipse.core.gwt_CONTAINER)出现在org.eclipse.buildship.core.gradleclasspathcontainer条目之后,以用于类加载 因此,我的.classpath文件的相关部分应该如下所示(底部有GWT\u容器) 使用/gradlew eclipse
.classpath
文件。我需要一个类路径条目(com.gwtplugins.gwt.eclipse.core.gwt_CONTAINER
)出现在org.eclipse.buildship.core.gradleclasspathcontainer
条目之后,以用于类加载
因此,我的.classpath
文件的相关部分应该如下所示(底部有GWT\u容器
)
使用/gradlew eclipsepasspath
时,将正确创建.classpath
文件。但一旦Buildship运行,文件就会再次被错误的顺序覆盖
我还尝试在合并时使用,而不是在合并前使用,但这并没有改变任何事情
以下是由Buildship启动时Gradle的输出(例如,单击Eclipse项目属性上的Gradle->Refresh):
Buildship似乎甚至不执行EclipsPasspath
任务,而是通过其他方式创建.classpath
文件
如何让Buildship实现我的愿望,让类路径按照我的方式排序?也许with xml
钩子的工作方式会有所不同
eclipse.classpath.file {
withXml { provider ->
def entry = provider.asNode().classpath.classpathentry.find { it.path == 'com.gwtplugins.gwt.eclipse.core.GWT_CONTAINER' }
println "Found $entry"
def parent = entry.parent()
parent.remove(entry)
parent.append(entry)
}
}
我发现:
Buildship不使用eclipsepasspath
任务,而是通过自己的方式读取配置并创建.classpath
。Gradle类路径将附加到类路径的末尾(如果尚未定义)。这是在执行合并时的部分后发生的。因此,解决方案是手动添加Gradle类路径:
eclipse {
classpath {
containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
}
}
您可以选择这个选项吗?我已经在使用它了(GWT的类路径条目就是从这里来的)。谢谢您的建议,但这不会改变结果:(println输出了什么?我刚刚注意到Buildship没有执行EclipsPasspath
任务。因此,此任务没有输出,但在Buildship运行后,.classpath
文件仍然存在。所以问题可能是Buildship使用了其他方法来创建此文件。Buildship运行以下任务:eclips。)eWtpComponent
、eclipseWtpFacet
和eclipseWtp
。如果我删除.classpath
并手动运行带有这些任务的Gradle,它不会创建新的.classpath
文件。Buildship应该在每次右键单击项目并选择“刷新Gradle项目”时触发EclipseEclipse
任务(buildship视图中还有一个刷新按钮。)GWT_容器是如何进入你的.classpath
的?你是手动添加的吗?任何添加都应该通过build.gradle
完成,而不是手动。我正在使用GWT插件(链接在问题下面的第一条注释中)。根据其日志,Buildship不使用EclipsPasspath
任务。
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.5/userguide/command_line_interface.html#sec:command_line_warnings
CONFIGURE SUCCESSFUL in 0s
:cleanEclipseWtpComponent
:cleanEclipseWtpFacet
:cleanEclipseWtp
:eclipseWtpComponent
:eclipseWtpFacet
:eclipseWtp
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 0s
4 actionable tasks: 4 executed
eclipse.classpath.file {
withXml { provider ->
def entry = provider.asNode().classpath.classpathentry.find { it.path == 'com.gwtplugins.gwt.eclipse.core.GWT_CONTAINER' }
println "Found $entry"
def parent = entry.parent()
parent.remove(entry)
parent.append(entry)
}
}
eclipse {
classpath {
containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
}
}