2013-03-15 106 views
1

我有一个gradle脚本为我设置了一个eclipse项目。除了默认的项目外,我的项目还需要添加额外的项目构面。 The documentation有下面的例子使用gradle添加eclipse项目构面

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 /) 。我试图将Vaadin的Eclipse插件插件添加到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> 

至于说,我所有方面在设置:)

+0

你运行了什么确切的任务来取代其他方面,以及哪些方面是那些?如果没有任何Eclipse文件(即新一代),您会期望发生什么? – 2013-03-15 18:53:39

+0

@PeterNiederwieser,我编辑了我的问题来反映你的问题。 – 2013-03-15 19:06:46

回答

3

修改默认值(而不是覆盖它们)ca ñ有时会非常棘手(它不是一个摇篮容易解决的问题),但你可以尝试以下方法:

facet { 
    facets = facets 
    facet name: 'com.vaadin.integration.eclipse.core', version: '7.0' 
} 

另外,你可以明确地声明默认方面,与您的自定义方面一起。

+0

完美,谢谢 – 2013-03-15 20:05:21