当前位置: 首页>>代码示例>>Java>>正文


Java InvocationRequest.setOffline方法代码示例

本文整理汇总了Java中org.apache.maven.shared.invoker.InvocationRequest.setOffline方法的典型用法代码示例。如果您正苦于以下问题:Java InvocationRequest.setOffline方法的具体用法?Java InvocationRequest.setOffline怎么用?Java InvocationRequest.setOffline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.shared.invoker.InvocationRequest的用法示例。


在下文中一共展示了InvocationRequest.setOffline方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrieve

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
public AddMvnCommandResult retrieve(List<Dependency> dependencies, MvnLoggerWidget progress) {
  File finalPom = null;
  try {
    String pomAsString = pomFactory.createPom(pathToMavenRepo, dependencies, commandParams.getRepos());
    finalPom = saveToFile(commandParams.getPathToNotebookJars(), pomAsString);
    InvocationRequest request = createInvocationRequest();
    request.setOffline(commandParams.getOffline());
    request.setPomFile(finalPom);
    request.setUpdateSnapshots(true);
    Invoker invoker = getInvoker(progress);
    progress.display();
    InvocationResult invocationResult = invoker.execute(request);
    progress.close();
    return getResult(invocationResult, dependencies);
  } catch (Exception e) {
    return AddMvnCommandResult.error(e.getMessage());
  } finally {
    deletePomFolder(finalPom);
  }
}
 
开发者ID:twosigma,项目名称:beakerx,代码行数:21,代码来源:MavenJarResolver.java

示例2: setupInvocationRequest

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
private InvocationRequest setupInvocationRequest() throws MojoExecutionException {
  InvocationRequest request = new DefaultInvocationRequest();
  request.setPomFile(this.project.getFile());
  // installation and deployment are performed in a later step. We first need to ensure that there are no changes in
  // the scm, ...
  request.setGoals(this.goals);
  request.setProperties(this.releaseArgs);
  request.setProfiles(this.profiles);
  request.setShellEnvironmentInherited(true);
  for (String key : this.releaseEnvironmentVariables.keySet()) {
    request.addShellEnvironment(key, this.releaseEnvironmentVariables.get(key));
  }
  request.setOffline(this.settings.isOffline());
  request.setInteractive(this.settings.isInteractiveMode());

  MavenExecutionRequest originalRequest = this.session.getRequest();
  File globalSettingsFile = originalRequest.getGlobalSettingsFile();
  if (globalSettingsFile != null && globalSettingsFile.exists() && globalSettingsFile.isFile()) {
    request.setGlobalSettingsFile(globalSettingsFile);
  }
  File userSettingsFile = originalRequest.getUserSettingsFile();
  if (userSettingsFile != null && userSettingsFile.exists() && userSettingsFile.isFile()) {
    request.setUserSettingsFile(userSettingsFile);
  }
  File toolchainsFile = originalRequest.getUserToolchainsFile();
  if (toolchainsFile.exists() && toolchainsFile.isFile()) {
    request.setToolchainsFile(toolchainsFile);
  }
  return request;
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:31,代码来源:BuildProject.java

示例3: createInvocationRequest

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
public InvocationRequest createInvocationRequest()
{
    InvocationRequest request = new DefaultInvocationRequest();

    request.setAlsoMake( alsoMake );
    request.setAlsoMakeDependents( alsoMakeDependents );
    request.setDebug( debug );
    request.setFailureBehavior( failureBehavior );
    request.setGlobalChecksumPolicy( globalChecksumPolicy );
    request.setGlobalSettingsFile( stringToFile( globalSettings ) );
    request.setGoals( goals );
    request.setInteractive( !batchMode );
    request.setJavaHome( stringToFile( javaHome ) );
    request.setLocalRepositoryDirectory( stringToFile( localRepository ) );
    request.setMavenOpts( mavenOpts );
    request.setOffline( offline );
    request.setPomFile( stringToFile( pomFile ) );
    request.setProfiles( profiles );
    request.setProjects( projects );
    request.setRecursive( !nonRecursive );
    request.setResumeFrom( resumeFrom );
    request.setShowErrors( showErrors );
    request.setShowVersion( showVersion );
    request.setThreads( threads );
    request.setToolchainsFile( stringToFile( toolchains ) );
    request.setUpdateSnapshots( updateSnapshots );
    request.setUserSettingsFile( stringToFile( userSettings ) );

    Properties properties = new Properties();
    defines.forEach( ( key, value ) -> properties.put( key, value ) );
    request.setProperties( properties );

    return request;
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:35,代码来源:BisectCliRequest.java

示例4: executeMavenGoal

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
public boolean executeMavenGoal(File projectPath, List<String> goals,
		boolean isOffline) {
	InvocationRequest request = new DefaultInvocationRequest();

	if (!projectPath.exists()) {
		projectPath.mkdirs();
	}

	request.setPomFile(new File(projectPath, POM_XML));

	if (goals == null) {
		goals = getDefaultMavenGoals();
	}
	request.setGoals(goals);
	Invoker invoker = new DefaultInvoker();
	request.setOffline(isOffline);

	try {
		InvocationResult result = invoker.execute(request);
		if (result.getExecutionException() == null) {
			if (result.getExitCode() != 0) {
				request.setOffline(!isOffline);
				result = invoker.execute(request);
				if (result.getExitCode() == 0) {
					return true;
				} else {
					final String errorMessage = "No maven Project found at "
							+ projectPath;
					log.error(errorMessage);
					throw new MavenInvocationException(errorMessage);
				}
			}
			return true;
		}
	} catch (MavenInvocationException e) {
		log.error("Maven invocation failed", e);
	}
	return false;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:40,代码来源:MavenExecutorImpl.java

示例5: newRunnable

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
protected final Runnable newRunnable( Holder<Exception> errorHolder, String... goals )
{
    return () ->
    {
        try
        {
            DefaultInvoker invoker = new DefaultInvoker();
            invoker.setLocalRepositoryDirectory( new File( BASEDIR, "target/it-local-repository" ) );
            invoker.setWorkingDirectory( tmp.getRoot() );
            invoker.setLogger( new PrintStreamLogger( System.err, InvokerLogger.INFO ) );

            InvocationRequest request = new DefaultInvocationRequest();
            request.setOffline( true );
            request.setPomFile( new File( tmp.getRoot(), "pom.xml" ) );
            request.setGoals( Arrays.asList( goals ) );

            InvocationResult result = invoker.execute( request );

            if( result.getExecutionException() != null )
            {
                errorHolder.set( result.getExecutionException() );
            }
            else if( result.getExitCode() != 0 )
            {
                errorHolder.set(
                    new RuntimeException( "Maven invocation failure, exit code was: " + result.getExitCode() )
                );
            }
        }
        catch( Exception ex )
        {
            errorHolder.set( ex );
        }
    };
}
 
开发者ID:werval,项目名称:werval,代码行数:36,代码来源:AbstractRunGoalIT.java

示例6: createAndConfigureAnInvocationRequest

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
protected InvocationRequest createAndConfigureAnInvocationRequest( ItemWithProperties currentValue )
    {
        InvocationRequest request = new DefaultInvocationRequest();

        request.setAlsoMake( isAlsoMake() );
        request.setAlsoMakeDependents( isAlsoMakeDependents() );
        request.setDebug( isDebug() );
        request.setFailureBehavior( getFailureBehaviour() );
        request.setGlobalChecksumPolicy( getGlobalChecksumPolicy() );
        request.setGlobalSettingsFile( getGlobalSettingsFile() );
        request.setInteractive( isInteractive() );

        request.setLocalRepositoryDirectory( getLocalRepositoryDirectory() );
        request.setMavenOpts( getMavenOpts() );
        request.setNonPluginUpdates( isNonPluginUpdates() );
        request.setOffline( isOffline() );

//        request.setProperties( properties )
//        ;
        // @TODO: Think about it.
        // request.setPomFile(pomFile);
        // @TODO: Think about it.
        // request.setPomFileName(pomFilename);

        // The following parameter do make sense to use a placeholder
        // base directory
        // cd @[email protected]
        // mvn clean package
        request.setBaseDirectory( getBaseDirectoryAfterPlaceHolderIsReplaced( currentValue.getName() ) );
        // goals:
        // mvn plugin-name:@[email protected]
        //
        request.setGoals( getGoalsAfterPlaceHolderIsReplaced( currentValue.getName() ) );
        // Profiles:
        // mvn [email protected]@ clean package
        // mvn [email protected]@
        request.setProfiles( getProfilesAfterPlaceHolderIsReplaced( currentValue.getName() ) );
        // Projects:
        // mvn -pl [email protected]@ clean package
        request.setProjects( getProjectsAfterPlaceHolderIsReplaced( currentValue.getName() ) );

        Properties props = getMergedProperties(currentValue );
        request.setProperties( props );

        request.setRecursive( isRecursive() );
        request.setResumeFrom( getResumeFrom() );
        request.setShellEnvironmentInherited( isShellEnvironmentInherited() );
        request.setShowErrors( isShowErrors() );
        request.setShowVersion( isShowVersion() );
        request.setThreads( getThreads() );
        request.setToolchainsFile( getToolchains() );
        request.setUpdateSnapshots( isUpdateSnapshots() );
        request.setUserSettingsFile( getUserSettings() );
        
        return request;
    }
 
开发者ID:khmarbaise,项目名称:iterator-maven-plugin,代码行数:57,代码来源:AbstractInvokerMojo.java


注:本文中的org.apache.maven.shared.invoker.InvocationRequest.setOffline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。