All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
uk.co.javahelp.maven.plugin.fitnesse.mojo.SetUpMojo Maven / Gradle / Ivy
package uk.co.javahelp.maven.plugin.fitnesse.mojo;
import static org.twdata.maven.mojoexecutor.MojoExecutor.configuration;
import static org.twdata.maven.mojoexecutor.MojoExecutor.element;
import static org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo;
import static org.twdata.maven.mojoexecutor.MojoExecutor.executionEnvironment;
import static org.twdata.maven.mojoexecutor.MojoExecutor.goal;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
* This Mojo is devoted simply to fetching and unpacking
* FitNesse into a correct working directory structure, and
* making sure everything is cleanly setup for running FitNesse.
*
* @goal set-up
* @phase pre-integration-test
*/
public class SetUpMojo extends AbstractSetupsMojo {
@Override
public void execute() throws MojoExecutionException {
clean();
unpack();
move();
}
/**
*
* {@code
*
* maven-clean-plugin
*
*
* pre-integration-test
*
* clean
*
*
* true
*
*
* ${fitnesse.working}
*
* plugins.properties
*
* false
*
*
* ${project.build.directory}/dependency-maven-plugin-markers
*
* *
*
* false
*
*
*
*
*
*
* }
*
*/
void clean() throws MojoExecutionException {
executeMojo(
plugin("org.apache.maven.plugins:maven-clean-plugin"),
goal("clean"),
configuration(
element("excludeDefaultDirectories", "true"),
element("filesets",
element("fileset",
element("directory", this.workingDir),
element("includes",
element("include", "plugins.properties")),
element("followSymlinks", "false")),
element("fileset",
element("directory", "${project.build.directory}/dependency-maven-plugin-markers"),
element("includes",
element("include", "*")),
element("followSymlinks", "false")))),
executionEnvironment(project, session, pluginManager)
);
}
/**
*
* {@code
*
* maven-dependency-plugin
* 2.4
*
*
* pre-integration-test
*
* unpack
*
*
*
*
* org.fitnesse
* fitnesse
* 20121220
* jar
* false
* ${fitnesse.working}
* Resources/FitNesseRoot/**
*
*
*
*
*
*
* }
*
*/
void unpack() throws MojoExecutionException {
final Artifact artifact = this.pluginDescriptor.getArtifactMap().get(FitNesse.artifactKey);
executeMojo(
plugin("org.apache.maven.plugins:maven-dependency-plugin"),
goal("unpack"),
configuration(
element("artifactItems",
element("artifactItem",
element("groupId", artifact.getGroupId()),
element("artifactId", artifact.getArtifactId()),
element("version", artifact.getVersion()),
element("type", "jar"),
element("overWrite", "false"),
element("outputDirectory", this.workingDir),
element("includes", "Resources/FitNesseRoot/**")))),
executionEnvironment(project, session, pluginManager)
);
}
/**
*
* {@code
*
* org.apache.maven.plugins
* maven-antrun-plugin
* 1.7
*
*
* pre-integration-test
*
* run
*
*
*
*
*
*
*
*
*
* }
*
*/
void move() throws MojoExecutionException {
final Xpp3Dom config = configuration(
element("target",
element("move")));
final Xpp3Dom move = config.getChild("target").getChild("move");
move.setAttribute("file", "${fitnesse.working}/Resources/FitNesseRoot");
move.setAttribute("todir", "${fitnesse.working}");
move.setAttribute("failonerror", "false");
executeMojo(
plugin("org.apache.maven.plugins:maven-antrun-plugin"),
goal("run"),
config,
executionEnvironment(project, session, pluginManager)
);
}
}