Plugin plugin = new Plugin();
plugin.setArtifactId("maven-dependency-plugin");
plugin.setExtensions(false);
PluginExecution execution = new PluginExecution();
execution.setId("unpack");
execution.setPhase("process-test-classes");
execution.addGoal("unpack");
ConfigurationBuilder configBuilder = ConfigurationBuilder.create();
ConfigurationElementBuilder artifactItem = configBuilder
.createConfigurationElement("artifactItems").addChild("artifactItem");
artifactItem.addChild("groupId").setText("org.jboss.as");
artifactItem.addChild("artifactId").setText("jboss-as-dist");
artifactItem.addChild("version").setText("7.1.0.CR1b");
artifactItem.addChild("type").setText("zip");
artifactItem.addChild("outputDirectory").setText("target/");
try {
new Xpp3DomBuilder();
execution.setConfiguration(
Xpp3DomBuilder.build(new ByteArrayInputStream(configBuilder.toString().getBytes()), "UTF-8"));
}
catch (XmlPullParserException e) {
throw new RuntimeException(e);
}