Search in sources :

Example 1 with MavenEmbedder

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();
}
Also used : MavenEmbedderConsoleLogger(org.apache.maven.embedder.MavenEmbedderConsoleLogger) MavenProject(org.apache.maven.project.MavenProject) MavenEmbedder(org.apache.maven.embedder.MavenEmbedder) File(java.io.File) Map(java.util.Map)

Example 2 with MavenEmbedder

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();
}
Also used : MavenEmbedderConsoleLogger(org.apache.maven.embedder.MavenEmbedderConsoleLogger) MavenProject(org.apache.maven.project.MavenProject) MavenEmbedder(org.apache.maven.embedder.MavenEmbedder) File(java.io.File)

Example 3 with MavenEmbedder

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();
}
Also used : MavenEmbedderConsoleLogger(org.apache.maven.embedder.MavenEmbedderConsoleLogger) MavenProject(org.apache.maven.project.MavenProject) MavenEmbedder(org.apache.maven.embedder.MavenEmbedder) File(java.io.File)

Aggregations

File (java.io.File)3 MavenEmbedder (org.apache.maven.embedder.MavenEmbedder)3 MavenEmbedderConsoleLogger (org.apache.maven.embedder.MavenEmbedderConsoleLogger)3 MavenProject (org.apache.maven.project.MavenProject)3 Map (java.util.Map)1