/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import groovy.text.* fileNames = [] File dir = new File(project.basedir, project.properties.getProperty('cocoon.sample.dir')) def excludedDirs = [".svn", ".settings", "target"] def excludedFiles = ["MockHttpServletRequest.java", "MockHttpServletResponse.java", "MockServletContext.java", "SitemapBuilderTest.java", ".classpath", ".project", "pom.xml", "NOTICE.txt", "LICENSE.txt", "ProfilingIntegrationTest.java", "MockXMLSitemapServlet.java", "SitemapServlet.java", "nbactions.xml"] def xClos xClos = { if(!excludedDirs.contains(it.name)) { it.eachDir(xClos); it.eachFile{ if(!it.isDirectory() && !excludedFiles.contains(it.name)) { fileNames << it.canonicalPath.substring(dir.canonicalPath.length() + 1).replace("\\", "/") } } } } xClos(dir) fileNames.sort() GStringTemplateEngine templateEngine = new GStringTemplateEngine() def template = templateEngine.createTemplate(new File(project.basedir, "archetype-template.xml")) Writable writable = template.make(['resources' : fileNames]) new File(project.basedir, "./src/main/resources/META-INF/maven/archetype.xml").write(writable.toString()); def ant = new AntBuilder(); ant.delete(dir: new File(project.basedir, "./src/main/resources/archetype-resources/src")) ant.delete(dir: "./src/main/resources/archetype-resources/rcl-config") ant.copy(todir: new File(project.basedir, "./src/main/resources/archetype-resources/src")) { fileset(dir: new File(dir, "src")) { exclude(name: '**/.svn') } } ant.copy(todir: new File(project.basedir, "./src/main/resources/archetype-resources/rcl-config")) { fileset(dir: new File(dir, "rcl-config")) { exclude(name: '**/.svn') } } ant.copy(todir: new File(project.basedir, "./src/main/resources/archetype-resources")) { fileset(dir: dir) { include(name: 'rcl.properties') } }