我有一个为我设置 Eclipse 项目的 gradle 脚本。我的项目除了默认的项目外,还需要添加一个额外的项目方面。该文档具有以下示例
eclipse {
wtp {
facet {
//you can add some extra wtp facets; mandatory keys: 'name', 'version':
facet name: 'someCoolFacet', version: '1.3'
}
}
}
我尝试使用给定的示例添加我自己的方面,但不是将方面添加到现有方面,它实际上替换了所有其他方面,因此是设置中的唯一方面。显然,这不是我想要的。问题是,如何向默认构面添加额外构面?
编辑:
我想创建一个脚本,将 eclipse 项目配置到一个文件夹,该文件夹仅包含 eclipse 项目的项目结构,但没有配置文件(.classpath、.project、.settings/)。我正在尝试将 Eclipse facet 的 Vaadin 插件添加到 Vaadin 项目中。这就是我的脚本的样子
subprojects {
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
sourceCompatibility = 1.6
targetCompatibility = 1.6
webAppDirName = 'WebContent'
vaadinDir = webAppDirName+'/VAADIN'
eclipse {
wtp {
facet {
facet name: 'com.vaadin.integration.eclipse.core', version: '7.0'
}
}
}
// Source directories
sourceSets{
main{
java{
srcDir 'src'
}
}
}
}
defaultTasks 'eclipse'
这是生成的构面设置
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="com.vaadin.integration.eclipse.core" version="7.0"/>
</faceted-project>
在不定义任何自定义方面的情况下,生成的配置是
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="jst.java"/>
<fixed facet="jst.web"/>
<installed facet="jst.web" version="2.4"/>
<installed facet="jst.java" version="6.0"/>
</faceted-project>
如前所述,我是设置中的所有方面:)