use of org.apache.maven.embedder.MavenEmbedder in project maven-plugins by apache.
the class AntBuildWriterUtilTest method testGetMavenJavadocPluginConfiguration.
/**
* Test method for 'org.apache.maven.plugin.ant.AntBuildWriterUtil.getMavenJavadocPluginConfiguration(MavenProject, String, String)'
*
* @throws Exception
*/
public void testGetMavenJavadocPluginConfiguration() throws Exception {
File testPom = new File(getBasedir(), "src/test/resources/unit/ant-javadoc-test/pom.xml");
MavenEmbedder maven = new MavenEmbedder();
maven.setClassLoader(Thread.currentThread().getContextClassLoader());
maven.setLogger(new MavenEmbedderConsoleLogger());
maven.setLocalRepositoryDirectory(getTestFile("target/local-repo"));
maven.setOffline(true);
maven.start();
MavenProject project = maven.readProject(testPom);
assertEquals(AntBuildWriterUtil.getMavenJavadocPluginBasicOption(project, "doclet", null), "gr.spinellis.umlgraph.doclet.UmlGraphDoc");
assertNotNull(AntBuildWriterUtil.getMavenJavadocPluginOptions(project, "links", null));
assertEquals(AntBuildWriterUtil.getMavenJavadocPluginOptions(project, "links", null).length, 2);
assertNotNull(AntBuildWriterUtil.getMavenJavadocPluginOptions(project, "docletArtifacts", null));
assertEquals(AntBuildWriterUtil.getMavenJavadocPluginOptions(project, "docletArtifacts", null).length, 2);
Map[] options = AntBuildWriterUtil.getMavenJavadocPluginOptions(project, "tags", null);
assertNotNull(options);
assertEquals(options.length, 1);
assertEquals(1, options[0].size());
Map properties = (Map) options[0].get("tag");
assertNotNull(properties);
assertEquals("requirement", properties.get("name"));
assertEquals("a", properties.get("placement"));
assertEquals("Software Requirement:", properties.get("head"));
maven.stop();
}
use of org.apache.maven.embedder.MavenEmbedder in project maven-plugins by apache.
the class AntBuildWriterUtilTest method testGetMavenCompilerPluginConfiguration.
/**
* Test method for 'org.apache.maven.plugin.ant.AntBuildWriterUtil.getMavenCompilerPluginConfiguration(MavenProject, String, String)'
*
* @throws Exception
*/
public void testGetMavenCompilerPluginConfiguration() throws Exception {
File testPom = new File(getBasedir(), "src/test/resources/unit/ant-compiler-config-test/pom.xml");
MavenEmbedder maven = new MavenEmbedder();
maven.setClassLoader(Thread.currentThread().getContextClassLoader());
maven.setLogger(new MavenEmbedderConsoleLogger());
maven.setLocalRepositoryDirectory(getTestFile("target/local-repo"));
maven.setOffline(true);
maven.start();
MavenProject project = maven.readProject(testPom);
assertEquals(AntBuildWriterUtil.getMavenCompilerPluginBasicOption(project, "debug", null), "true");
assertNotNull(AntBuildWriterUtil.getMavenCompilerPluginOptions(project, "includes", null));
assertEquals(AntBuildWriterUtil.getMavenCompilerPluginOptions(project, "includes", null).length, 2);
assertNotNull(AntBuildWriterUtil.getMavenCompilerPluginOptions(project, "excludes", null));
assertEquals(AntBuildWriterUtil.getMavenCompilerPluginOptions(project, "excludes", null).length, 1);
maven.stop();
}
use of org.apache.maven.embedder.MavenEmbedder in project maven-plugins by apache.
the class AntBuildWriterUtilTest method testGetMavenWarPluginConfiguration.
/**
* Test method for 'org.apache.maven.plugin.ant.AntBuildWriterUtil.getMavenWarPluginConfiguration(MavenProject, String, String)'
*
* @throws Exception
*/
public void testGetMavenWarPluginConfiguration() throws Exception {
File testPom = new File(getBasedir(), "src/test/resources/unit/ant-war-config-test/pom.xml");
MavenEmbedder maven = new MavenEmbedder();
maven.setClassLoader(Thread.currentThread().getContextClassLoader());
maven.setLogger(new MavenEmbedderConsoleLogger());
maven.setLocalRepositoryDirectory(getTestFile("target/local-repo"));
maven.setOffline(true);
maven.start();
MavenProject project = maven.readProject(testPom);
assertEquals(AntBuildWriterUtil.getMavenWarPluginBasicOption(project, "warName", null), "mywebapp");
assertTrue(AntBuildWriterUtil.getMavenWarPluginBasicOption(project, "webXml", null).endsWith("/src/main/webapp/WEB-INF/web.xml"));
maven.stop();
}
Aggregations