Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ant = new AntBuilder(); // create an antbuilder
- def contentJar = "target/site/content.jar"
- def contentDir = "target/content.jar/"
- println 'unzipping content.jar'
- ant.unzip( src: contentJar, dest:contentDir, overwrite:"true")
- println ' Doing some black magic'
- def contentJar2 = "target/site/content2.jar"
- File contentXml = new File(contentDir, "content.xml")
- def root = new XmlParser().parseText(contentXml.text)
- def feature = root.units.unit.find{ it.@id=="org.eclipse.m2e.wtp.feature.feature.group"}
- def version = feature.@version
- println "found " + feature.@id + '-' + version
- def matchDefinition = "providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.maven.ide.wtp' || pc.name == 'org.eclipse.m2e.wtp' && pc.version > '${version}'))"
- println matchDefinition
- feature.update.@match = matchDefinition
- def writer = new StringWriter()
- new XmlNodePrinter(new PrintWriter(writer)).print(root)
- contentXml.write(writer.toString())
- println 'zipping customized content.jar'
- ant.zip( destFile: contentJar2, baseDir:contentDir)
Add Comment
Please, Sign In to add comment