Package org.apache.maven.embedder

Examples of org.apache.maven.embedder.MavenEmbedder


    private MavenEmbedder maven;
    private Properties sysProps = System.getProperties();
    private String version;

    protected void setUp() throws Exception {
        maven = new MavenEmbedder();
        maven.setOffline(true);
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        maven.setClassLoader(classLoader);
        MavenEmbedderLogger logger = new MavenEmbedderConsoleLogger();
        //logger.setThreshold(MavenEmbedderLogger.LEVEL_DEBUG);
View Full Code Here


    private Properties sysProps = System.getProperties();
    private String version;

    @Override
    protected void setUp() throws Exception {
        maven = new MavenEmbedder();
        maven.setOffline(false);
        System.err.println(sysProps.getProperty(MAVEN_REPO_LOCAL));
        if (StringUtils.isNotEmpty(sysProps.getProperty(MAVEN_REPO_LOCAL))) {
            maven.setLocalRepositoryDirectory(new File(sysProps.getProperty(MAVEN_REPO_LOCAL)));
        }
View Full Code Here

    private MavenEmbedder maven;
    private Properties sysProps = System.getProperties();
    private String version;

    protected void setUp() throws Exception {
        maven = new MavenEmbedder();
        maven.setOffline(false);
        System.err.println(sysProps.getProperty(MAVEN_REPO_LOCAL));
        if (StringUtils.isNotEmpty(sysProps.getProperty(MAVEN_REPO_LOCAL))) {
            maven.setLocalRepositoryDirectory(new File(sysProps.getProperty(MAVEN_REPO_LOCAL)));
        }
View Full Code Here

    private MavenEmbedder maven;
    private Properties sysProps = System.getProperties();
    private String version;
   
    protected void setUp() throws Exception {
        maven = new MavenEmbedder();
        maven.setOffline(true);
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        maven.setClassLoader(classLoader);
        MavenEmbedderLogger logger = new MavenEmbedderConsoleLogger();
        //logger.setThreshold(MavenEmbedderLogger.LEVEL_DEBUG);
View Full Code Here

    private MavenEmbedder maven;
    private Properties sysProps = System.getProperties();
    private String version;

    protected void setUp() throws Exception {
        maven = new MavenEmbedder();
        maven.setOffline(false);
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        maven.setClassLoader(classLoader);
        MavenEmbedderLogger logger = new MavenEmbedderConsoleLogger();
        //logger.setThreshold(MavenEmbedderLogger.LEVEL_DEBUG);
View Full Code Here

    private Properties sysProps = System.getProperties();
    private String version;

    @Override
    protected void setUp() throws Exception {
        maven = new MavenEmbedder();
        maven.setOffline(false);
        System.err.println(sysProps.getProperty(MAVEN_REPO_LOCAL));
        if (StringUtils.isNotEmpty(sysProps.getProperty(MAVEN_REPO_LOCAL))) {
            maven.setLocalRepositoryDirectory(new File(sysProps.getProperty(MAVEN_REPO_LOCAL)));
        }
View Full Code Here

        return dependencies;
    }

    private MavenProject createProjectFromPom(File pom) {
        MavenEmbedder maven = new MavenEmbedder();
        maven.setOffline(true);
        maven.setClassLoader(Thread.currentThread().getContextClassLoader());
        maven.setLogger(new MavenEmbedderConsoleLogger());

        MavenProject p = null;

        try {
            maven.setAlignWithUserInstallation(true);
            maven.start();
            p = maven.readProjectWithDependencies(pom);
            maven.stop();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return p;
View Full Code Here

    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();
    }
View Full Code Here

    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();
    }
View Full Code Here

    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();
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.embedder.MavenEmbedder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.