All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.archetype-post-generate.groovy Maven / Gradle / Ivy

@Grab(group="org.codehaus.groovy", module="groovy-all", version="2.4.8")
import static groovy.io.FileType.*
import java.nio.file.Path

def rootDir = new java.io.File(request.getOutputDirectory() + "/" + request.getArtifactId())
def rootPom = new java.io.File(rootDir, "pom.xml")
setupModules(rootPom);

def setupModules(pomFile) {
    def content = pomFile.text;
    def modulesPos = content.indexOf("");
    def endTag = "";

    def modulesEndPos = content.indexOf(endTag) + endTag.length();
    def modulesSection = "\ncommon\n";

    content = content.substring(0, modulesPos) + modulesSection + content.substring(modulesEndPos);
    pomFile.newWriter("UTF-8").withWriter { w ->
        w << content
    }


}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy