EclipseWtp's component block doesn't generate wb-resource/wb-property elements


(Todd Gerspacher) #1

EclipseWtp’s component block seems to be broken. According to the DSL for EclipseWtpComponent, the following build script should add a wb-resource element and a wb-property element to the generated org.eclipse.wst.common.component file.

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
  eclipse {
  wtp {
    component {
      property name: 'moodOfTheDay', value: ':-D'
      resource sourcePath: 'extra/resource', deployPath: 'deployment/resource'
    }
  }
}

Unfortunately, neither element (with the specified attributes) appear in the file. I can add a new element with the following build script.

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
  eclipse {
  wtp {
    component {
      file {
        withXml {
          def node = it.asNode( )
          node.appendNode('xml', 'is what I love')
        }
      }
    }
  }
}

The only problem is that the new element appears after the wb-module end tag. I need to replace the child nodes of the wb-module element in the org.eclipse.wst.common.component file.


(Peter Niederwieser) #2

You first snippet works fine for me, both for the property and the resource. Note that the resource will only be added if its source path exists (as indicated in the docs).


(Todd Gerspacher) #3

Thank you for taking the time to answer my question. Somehow I glossed over and missed the statement about the sourcePath needing to exist. Everything seems to be working now. Sorry about the false alarm.