use of org.apache.maven.plugin.Mojo in project byte-buddy by raphw.
the class ByteBuddyMojoTest method execute.
private void execute(String goal, String target) throws Exception {
Mojo mojo = mojoRule.lookupMojo(goal, new File("src/test/resources/net/bytebuddy/test/" + target + ".pom.xml"));
if (goal.equals("transform")) {
mojoRule.setVariableValueToObject(mojo, "outputDirectory", project.getAbsolutePath());
mojoRule.setVariableValueToObject(mojo, "compileClasspathElements", Collections.emptyList());
} else if (goal.equals("transform-test")) {
mojoRule.setVariableValueToObject(mojo, "testOutputDirectory", project.getAbsolutePath());
mojoRule.setVariableValueToObject(mojo, "testClasspathElements", Collections.emptyList());
} else {
throw new AssertionError("Unknown goal: " + goal);
}
mojoRule.setVariableValueToObject(mojo, "repositorySystem", repositorySystem);
mojoRule.setVariableValueToObject(mojo, "groupId", FOO);
mojoRule.setVariableValueToObject(mojo, "artifactId", BAR);
mojoRule.setVariableValueToObject(mojo, "version", QUX);
mojo.setLog(new SilentLog());
mojo.execute();
}
use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class TestSkip method doConfigTest.
private void doConfigTest(String mojoName, String configFile) throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/skip-test/" + configFile);
Mojo mojo = lookupMojo(mojoName, testPom);
assertNotNull(mojo);
CapturingLog log = new CapturingLog();
mojo.setLog(log);
mojo.execute();
assertTrue(log.getContent().contains("Skipping plugin execution"));
}
use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class BasicAbstractAssemblyMojoFeaturesTest method run.
private Mojo run(String pluginConfig, String mojoName) throws Exception {
String pluginConfigResource = "basicAbstractAssemblyMojoFeaturesTest/" + pluginConfig;
File pluginConfigFile = new File(getBasedir(), "src/test/plugin-configs/" + pluginConfigResource);
assertTrue("Cannot find plugin-configuration: \'" + pluginConfigResource + "\' in context-classloader\'s classpath.", pluginConfigFile.exists());
// TODO: Need to replace this with test-only mojos...
Mojo mojo = (Mojo) lookupMojo(mojoName, pluginConfigFile.getAbsolutePath());
FileLoggingArchiverManagerStub archiverManager = (FileLoggingArchiverManagerStub) getVariableValueFromObject(mojo, "archiverManager");
archiverManager.clearArchiver();
mojo.execute();
return mojo;
}
use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class BasicAbstractAssemblyMojoFeaturesTest method testOutputFileNameMapping.
public void testOutputFileNameMapping() throws Exception {
String pluginConfig = "outputFileNameMapping-pluginConfig.xml";
List requiredDependencies = new ArrayList();
requiredDependencies.add("dependencies/test.jar");
requiredDependencies.add("dependencies/test2.jar");
Mojo mojo = run(pluginConfig, "directory-inline");
assertFilesAdded(mojo, requiredDependencies);
}
use of org.apache.maven.plugin.Mojo in project maven-plugins by apache.
the class BasicAbstractAssemblyMojoFeaturesTest method testModuleSetSourceIncludedBinariesNotIncluded.
public void testModuleSetSourceIncludedBinariesNotIncluded() throws Exception {
String pluginConfig = "moduleSetSourceIncludedBinariesNotIncluded-pluginConfig.xml";
Mojo mojo = run(pluginConfig, "attached");
List required = Collections.singletonList("sources/module1/src/main/java/org/test/module1/App.java");
assertFilesAdded(mojo, required);
}
Aggregations