Package org.apache.maven.shared.invoker

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


        if (!props.containsKey("rootdir"))
        {
            props.put("rootdir", rootdir);
        }

        InvocationRequest request = new DefaultInvocationRequest();
       
        if (!StringUtils.isEmpty(target.goals))
        {
            List<String> goals = Arrays.asList(StringUtils.split(target.goals, ", "));
            targetCmdMessage.append(" "+StringUtils.join( goals.iterator(), " " ));
            request.setGoals(goals);
        }
        if (!StringUtils.isEmpty(target.profiles))
        {
            List<String> profiles = Arrays.asList(StringUtils.split(target.profiles, ", "));
            targetCmdMessage.append(" "+StringUtils.join( profiles.iterator(), " " ));
            request.setProfiles(profiles);
        }
        request.setProperties(props);
        request.setInteractive( false );
        request.setShowErrors(getLog().isErrorEnabled());
        request.setDebug(getLog().isDebugEnabled());
        request.setOffline(settings.isOffline());
        if (settings.getLocalRepository() != null)
        {
            request.setLocalRepositoryDirectory(new File(settings.getLocalRepository()));
        }
        String mavenOpts = props.getProperty("jetspeed.mvn.mavenOpts", null);
        if (StringUtils.isEmpty(mavenOpts) && !StringUtils.isEmpty(target.mavenOpts))
        {
            mavenOpts = target.mavenOpts;
        }
        if (StringUtils.isEmpty(mavenOpts) && !StringUtils.isEmpty(this.mavenOpts))
        {
            mavenOpts = this.mavenOpts;
        }
        if (!StringUtils.isEmpty(mavenOpts))
        {
            request.setMavenOpts(mavenOpts);
        }
               
        request.setBaseDirectory( targetPom.getParentFile() );
       
        if (target.name != null)
        {
            targetPom = buildInterpolatedFile( targetPom, targetPom.getParentFile(), targetPomName+".interpolated", filter);
        }
        request.setPomFile(targetPom);
       
        File settingsFile = null;
        String settingsFileName = (String)filter.get("jetspeed.mvn.settings.xml");
        if (settingsFileName == null)
        {
          settingsFileName = target.settingsFile;
        }
        if (settingsFileName != null )
        {
            settingsFileName = interpolateRootDir(settingsFileName);
            settingsFile = new File(settingsFileName);
            if (!settingsFile.exists() || !settingsFile.isFile())
            {
                settingsFile = null;
            }
        }
        if (settingsFile == null && useSettings)
        {
            settingsFile = getLocalOrProjectFile(targetPom.getParentFile(), project, "jetspeed-mvn-settings.xml");
        }
       
        if (settingsFile != null)
        {
            settingsFile = buildInterpolatedFile( settingsFile, settingsFile.getParentFile(), settingsFile.getName()+".interpolated", filter);
            request.setUserSettingsFile(settingsFile);
        }
        try
        {
            getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) );
        }
View Full Code Here


            }

            scriptRunner.run( "pre-build script", basedir, preBuildHookScript, context, logger,
                              BuildJob.Result.FAILURE_PRE_HOOK, false );

            final InvocationRequest request = new DefaultInvocationRequest();

            request.setLocalRepositoryDirectory( localRepositoryPath );

            request.setInteractive( false );

            request.setShowErrors( showErrors );

            request.setDebug( debug );

            request.setShowVersion( showVersion );
           
            if ( logger != null )
            {
                request.setErrorHandler( logger );

                request.setOutputHandler( logger );
            }

            if ( mavenHome != null )
            {
                invoker.setMavenHome( mavenHome );
                request.addShellEnvironment( "M2_HOME", mavenHome.getAbsolutePath() );
            }
           
            if ( mavenExecutable != null )
            {
                invoker.setMavenExecutable( new File( mavenExecutable ) );
            }

            if ( javaHome != null )
            {
                request.setJavaHome( javaHome );
            }
           
            if ( environmentVariables != null )
            {
                for ( Map.Entry<String, String> variable : environmentVariables.entrySet() )
                {
                    request.addShellEnvironment( variable.getKey(), variable.getValue() );
                }
            }

            for ( int invocationIndex = 1; ; invocationIndex++ )
            {
                if ( invocationIndex > 1 && !invokerProperties.isInvocationDefined( invocationIndex ) )
                {
                    break;
                }

                request.setBaseDirectory( basedir );

                request.setPomFile( pomFile );

                request.setGoals( goals );

                request.setProfiles( profiles );

                request.setMavenOpts( mavenOpts );

                request.setOffline( false );

                request.setUserSettingsFile( settingsFile );

                Properties systemProperties =
                    getSystemProperties( basedir, invokerProperties.getSystemPropertiesFile( invocationIndex ) );
                request.setProperties( systemProperties );

                invokerProperties.configureInvocation( request, invocationIndex );

                if ( getLog().isDebugEnabled() )
                {
                    try
                    {
                        getLog().debug( "Using MAVEN_OPTS: " + request.getMavenOpts() );
                        getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) );
                    }
                    catch ( CommandLineConfigurationException e )
                    {
                        getLog().debug( "Failed to display command line: " + e.getMessage() );
View Full Code Here

            }

            scriptRunner.run( "pre-build script", basedir, preBuildHookScript, context, logger,
                              BuildJob.Result.FAILURE_PRE_HOOK, false );

            final InvocationRequest request = new DefaultInvocationRequest();

            request.setLocalRepositoryDirectory( localRepositoryPath );

            request.setInteractive( false );

            request.setShowErrors( showErrors );

            request.setDebug( debug );

            request.setShowVersion( showVersion );

            if ( logger != null )
            {
                request.setErrorHandler( logger );

                request.setOutputHandler( logger );
            }

            if ( mavenHome != null )
            {
                invoker.setMavenHome( mavenHome );
                request.addShellEnvironment( "M2_HOME", mavenHome.getAbsolutePath() );
            }

            if ( javaHome != null )
            {
                request.setJavaHome( javaHome );
            }

            for ( int invocationIndex = 1; ; invocationIndex++ )
            {
                if ( invocationIndex > 1 && !invokerProperties.isInvocationDefined( invocationIndex ) )
                {
                    break;
                }

                request.setBaseDirectory( basedir );

                request.setPomFile( pomFile );

                request.setGoals( goals );

                request.setProfiles( profiles );

                request.setMavenOpts( mavenOpts );

                request.setOffline( false );

                request.setUserSettingsFile( settingsFile );

                Properties systemProperties =
                    getSystemProperties( basedir, invokerProperties.getSystemPropertiesFile( invocationIndex ) );
                request.setProperties( systemProperties );

                invokerProperties.configureInvocation( request, invocationIndex );

                if ( getLog().isDebugEnabled() )
                {
                    try
                    {
                        getLog().debug( "Using MAVEN_OPTS: " + request.getMavenOpts() );
                        getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) );
                    }
                    catch ( CommandLineConfigurationException e )
                    {
                        getLog().debug( "Failed to display command line: " + e.getMessage() );
View Full Code Here

        if (!props.containsKey("rootdir"))
        {
            props.put("rootdir", rootdir);
        }

        InvocationRequest request = new DefaultInvocationRequest();
       
        if (!StringUtils.isEmpty(target.goals))
        {
            List<String> goals = Arrays.asList(StringUtils.split(target.goals, ", "));
            targetCmdMessage.append(" "+StringUtils.join( goals.iterator(), " " ));
            request.setGoals(goals);
        }
        if (!StringUtils.isEmpty(target.profiles))
        {
            List<String> profiles = Arrays.asList(StringUtils.split(target.profiles, ", "));
            targetCmdMessage.append(" "+StringUtils.join( profiles.iterator(), " " ));
            request.setProfiles(profiles);
        }
        request.setProperties(props);
        request.setInteractive( false );
        request.setShowErrors(getLog().isErrorEnabled());
        request.setDebug(getLog().isDebugEnabled());
        request.setOffline(settings.isOffline());
        if (settings.getLocalRepository() != null)
        {
            request.setLocalRepositoryDirectory(new File(settings.getLocalRepository()));
        }
        String mavenOpts = props.getProperty("jetspeed.mvn.mavenOpts", null);
        if (StringUtils.isEmpty(mavenOpts) && !StringUtils.isEmpty(target.mavenOpts))
        {
            mavenOpts = target.mavenOpts;
        }
        if (StringUtils.isEmpty(mavenOpts) && !StringUtils.isEmpty(this.mavenOpts))
        {
            mavenOpts = this.mavenOpts;
        }
        if (!StringUtils.isEmpty(mavenOpts))
        {
            request.setMavenOpts(mavenOpts);
        }
               
        request.setBaseDirectory( targetPom.getParentFile() );
       
        if (target.name != null)
        {
            targetPom = buildInterpolatedFile( targetPom, targetPom.getParentFile(), targetPomName+".interpolated", filter);
        }
        request.setPomFile(targetPom);
       
        File settingsFile = null;
        String settingsFileName = (String)filter.get("jetspeed.mvn.settings.xml");
        if (settingsFileName == null)
        {
          settingsFileName = target.settingsFile;
        }
        if (settingsFileName != null )
        {
            settingsFileName = interpolateRootDir(settingsFileName);
            settingsFile = new File(settingsFileName);
            if (!settingsFile.exists() || !settingsFile.isFile())
            {
                settingsFile = null;
            }
        }
        if (settingsFile == null && useSettings)
        {
            settingsFile = getLocalOrProjectFile(targetPom.getParentFile(), project, "jetspeed-mvn-settings.xml");
        }
       
        if (settingsFile != null)
        {
            settingsFile = buildInterpolatedFile( settingsFile, settingsFile.getParentFile(), settingsFile.getName()+".interpolated", filter);
            request.setUserSettingsFile(settingsFile);
        }
        try
        {
            getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) );
        }
View Full Code Here

TOP

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

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.