I came up with a better solution than the one I started with.
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
configurations {
passemble
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
passemble 'org.apache.portals.pluto:pluto-ant-tasks:2.0.3'
}
sourceSets {
main {
java {
srcDirs "src"
}
resources {
srcDir "src"
}
}
}
eclipse {
wtp {
component {
resource deployPath: '/', sourcePath: '/WebContent', tag: 'defaultRootSource'
resource deployPath: '/WEB-INF/classes', sourcePath: '/src'
}
}
}
task passemble {
description = 'Assemble project so that it may be run on Apache Pluto'
doLast {
println 'creating taskdef passemble...'
ant.taskdef(name: 'passemble', classname: 'org.apache.pluto.ant.AssembleTask', classpath: configurations.passemble.asPath)
println 'creating temporary web.xml file...'
File tmp = file('web.xml')
tmp.createNewFile()
PrintWriter printWriter = new PrintWriter(tmp);
printWriter.println '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
printWriter.println '<!DOCTYPE web-app PUBLIC'
printWriter.println '
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"'
printWriter.println '
"http://java.sun.com/dtd/web-app_2_3.dtd">'
printWriter.println '<web-app id="WebApp_ID">'
printWriter.println '</web-app>'
printWriter.close();
println 'executing task passemble...'
ant.passemble(
webxml: 'web.xml',
portletxml: 'WebContent/WEB-INF/portlet.xml',
destfile: 'WebContent/WEB-INF/web.xml')
println 'deleting temporary web.xml file...'
delete file('web.xml')
}
}