Package org.apache.maven.shared.invoker

Examples of org.apache.maven.shared.invoker.InvocationResult


            request.setProperties(props);

            getLog().info("Installing aggregated zip using: mvn install:install-file" + serializeMvnProperties(props));
            Invoker invoker = new DefaultInvoker();
            try {
                InvocationResult result = invoker.execute(request);
                if (result.getExitCode() != 0) {
                    throw new IllegalStateException("Error invoking Maven goal install:install-file");
                }
            } catch (MavenInvocationException e) {
                throw new MojoExecutionException("Error invoking Maven goal install:install-file", e);
            }
        }

        if (rootProject.hasLifecyclePhase("deploy")) {
            getLog().info("Deploying aggregated zip " + projectOutputFile + " to root project " + rootProject.getArtifactId());

            InvocationRequest request = new DefaultInvocationRequest();
            request.setBaseDirectory(rootProject.getBasedir());
            request.setPomFile(new File("./pom.xml"));
            request.setGoals(Collections.singletonList("deploy:deploy-file"));
            request.setRecursive(false);
            request.setInteractive(false);

            Properties props = new Properties();
            props.setProperty("file", aggregatedZipFileName);
            props.setProperty("groupId", rootProjectGroupId);
            props.setProperty("artifactId", rootProjectArtifactId);
            props.setProperty("version", rootProjectVersion);
            props.setProperty("classifier", "app");
            props.setProperty("packaging", "zip");
            props.setProperty("url", deploymentRepository.getUrl());
            props.setProperty("repositoryId", deploymentRepository.getId());
            request.setProperties(props);

            getLog().info("Deploying aggregated zip using: mvn deploy:deploy-file" + serializeMvnProperties(props));
            Invoker invoker = new DefaultInvoker();
            try {
                InvocationResult result = invoker.execute(request);
                if (result.getExitCode() != 0) {
                    throw new IllegalStateException("Error invoking Maven goal deploy:deploy-file");
                }
            } catch (MavenInvocationException e) {
                throw new MojoExecutionException("Error invoking Maven goal deploy:deploy-file", e);
            }
View Full Code Here


            request.setProperties(props);

            getLog().info("Installing aggregated zip using: mvn install:install-file" + serializeMvnProperties(props));
            Invoker invoker = new DefaultInvoker();
            try {
                InvocationResult result = invoker.execute(request);
                if (result.getExitCode() != 0) {
                    throw new IllegalStateException("Error invoking Maven goal install:install-file");
                }
            } catch (MavenInvocationException e) {
                throw new MojoExecutionException("Error invoking Maven goal install:install-file", e);
            }
View Full Code Here

        }
        catch (CommandLineConfigurationException e)
        {
            getLog().debug( "Failed to display command line: " + e.getMessage() );
        }
        InvocationResult result = null;

        try
        {
            getLog().info(targetCmdMessage.toString());
            if (invoker.getLogger() == null)
            {
                invoker.setLogger(new SystemOutLogger());
            }
            result = invoker.execute( request );
        }
        catch ( MavenInvocationException e )
        {
            getLog().debug( "Error invoking Maven: " + e.getMessage(), e );
            throw new MojoFailureException("...FAILED[error invoking Maven]");
        }

        CommandLineException executionException = result.getExecutionException();
        if ( executionException != null )
        {
            throw new MojoFailureException("...FAILED");
        }
        else if ( ( result.getExitCode() != 0 ) )
        {
            throw new MojoFailureException("...FAILED[code=" + result.getExitCode() + "].");
        }
        else
        {
            getLog().info( "...SUCCESS." );
        }
View Full Code Here

                    {
                        getLog().debug( "Failed to display command line: " + e.getMessage() );
                    }
                }

                InvocationResult result;

                try
                {
                    result = invoker.execute( request );
                }
View Full Code Here

                    {
                        getLog().debug( "Failed to display command line: " + e.getMessage() );
                    }
                }

                InvocationResult result;

                try
                {
                    result = invoker.execute( request );
                }
View Full Code Here

        }
        catch (CommandLineConfigurationException e)
        {
            getLog().debug( "Failed to display command line: " + e.getMessage() );
        }
        InvocationResult result = null;

        try
        {
            getLog().info(targetCmdMessage.toString());
            if (invoker.getLogger() == null)
            {
                invoker.setLogger(new SystemOutLogger());
            }
            result = invoker.execute( request );
        }
        catch ( MavenInvocationException e )
        {
            getLog().debug( "Error invoking Maven: " + e.getMessage(), e );
            throw new MojoFailureException("...FAILED[error invoking Maven]");
        }

        CommandLineException executionException = result.getExecutionException();
        if ( executionException != null )
        {
            throw new MojoFailureException("...FAILED");
        }
        else if ( ( result.getExitCode() != 0 ) )
        {
            throw new MojoFailureException("...FAILED[code=" + result.getExitCode() + "].");
        }
        else
        {
            getLog().info( "...SUCCESS." );
        }
View Full Code Here

TOP

Related Classes of org.apache.maven.shared.invoker.InvocationResult

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.