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


Java GradleConnector.useGradleVersion方法代码示例

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


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

示例1: createProjectConnection

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
private ProjectConnection createProjectConnection(ComparableGradleBuildExecuter executer) {
    GradleConnector connector = GradleConnector.newConnector();
    connector.forProjectDirectory(executer.getSpec().getProjectDir());
    File gradleUserHomeDir = gradle.getStartParameter().getGradleUserHomeDir();
    if (gradleUserHomeDir != null) {
        connector.useGradleUserHomeDir(gradleUserHomeDir);
    }

    GradleVersion gradleVersion = executer.getGradleVersion();
    if (gradleVersion.equals(GradleVersion.current())) {
        connector.useInstallation(gradle.getGradleHomeDir());
    } else {
        connector.useGradleVersion(gradleVersion.getVersion());
    }

    return connector.connect();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:GradleBuildComparison.java

示例2: generate

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
@Override
public void generate(File targetDir, ProjectRequest projectRequest) {
    GradleConnector gradleConnector = GradleConnector.newConnector().forProjectDirectory(targetDir);

    if (projectRequest.getGradleVersion() != null) {
        gradleConnector.useGradleVersion(projectRequest.getGradleVersion());
    }

    ProjectConnection connection = gradleConnector.connect();

    try {
        connection.newBuild().forTasks(buildTasks(projectRequest)).run();
    } finally {
        connection.close();
    }
}
 
开发者ID:bmuschko,项目名称:gradle-initializr,代码行数:17,代码来源:ToolingApiProjectGenerator.java

示例3: createProject

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
public ProjectConnection createProject(String name) throws IOException {
	File projectDirectory = new File("target/" + name);
	projectDirectory.mkdirs();

	File gradleScript = new File(projectDirectory, "build.gradle");

	if (new File("src/test/resources", name).isDirectory()) {
		FileSystemUtils.copyRecursively(new File("src/test/resources", name),
				projectDirectory);
	}
	else {
		FileCopyUtils.copy(new File("src/test/resources/" + name + ".gradle"),
				gradleScript);
	}

	GradleConnector gradleConnector = GradleConnector.newConnector();
	gradleConnector.useGradleVersion(this.gradleVersion);

	((DefaultGradleConnector) gradleConnector).embedded(true);
	return gradleConnector.forProjectDirectory(projectDirectory).connect();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:ProjectCreator.java

示例4: createConnector

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
/**
 * Creates a new Gradle connector for the context.
 * @param context the target context
 * @return a connector
 */
public static GradleConnector createConnector(GradleContext context) {
    GradleConnector connector = GradleConnector.newConnector();
    connector.forProjectDirectory(context.getProjectDirectory().getAbsoluteFile());
    String versionLabel;
    if (context.getGradleDistribution() != null) {
        versionLabel = context.getGradleDistribution().toString();
        connector.useDistribution(context.getGradleDistribution());
    } else {
        String version = context.getGradleVersion();
        version = version == null ? GradleVersion.current().getVersion() : version;
        versionLabel = version;
        URI distribution = toDistributionUri(version, context.isUseHttps());
        if (distribution != null) {
            connector.useDistribution(distribution);
        } else {
            connector.useGradleVersion(version);
        }
    }
    context.information(MessageFormat.format(
            Messages.GradleUtil_infoPrepareDaemon,
            versionLabel));
    if (context.getGradleUserHomeDir() != null) {
        connector.useGradleUserHomeDir(context.getGradleUserHomeDir().getAbsoluteFile());
    }
    return connector;
}
 
开发者ID:asakusafw,项目名称:asakusafw-shafu,代码行数:32,代码来源:GradleUtil.java

示例5: configureGradleRuntime

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
/**
 * Configure the gradle runtime, version or home depending on the settings.
 * @param connector
 */
public static void configureGradleRuntime(GradleConnector connector, IPreferenceStore prefs) {
	
	String gradleVersion = prefs.getString(WorkbenchPreferencePage.GRADLE_VERSION_ID);
	
	if (GradlePluginConstants.USE_GRADLE_HOME_VERSION_VALUE.equals(gradleVersion)) {
		String gradleHome = prefs.getString(WorkbenchPreferencePage.GRADLE_HOME_ID);
		
		File gradleHomeDir = new File(gradleHome);
		
		if (isFileValidGradleInstallation(gradleHomeDir)) {
			connector.useInstallation(gradleHomeDir);
			return;
		} else {
			throw new IllegalStateException("Configured gradle home is not valid");
		}
	}
	
	connector.useGradleVersion(gradleVersion);
}
 
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:24,代码来源:GradlePluginUtils.java

示例6: applyTo

import org.gradle.tooling.GradleConnector; //导入方法依赖的package包/类
@Override
public void applyTo(GradleConnector gradleConnector) {
    gradleConnector.useGradleVersion(gradleVersion);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:GradleProvider.java


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