Add integration test for "gradle install"

See gh-1105
This commit is contained in:
Dave Syer 2014-06-16 12:56:50 +01:00
parent 7c0c2e9ea5
commit 8b03834d79
2 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,48 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.gradle;
import java.io.IOException;
import org.gradle.tooling.ProjectConnection;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.dependency.tools.ManagedDependencies;
/**
* Tests for using the Gradle plugin's support for installing artifacts
*
* @author Dave Syer
*/
public class InstallTests {
private static ProjectConnection project;
private static final String BOOT_VERSION = ManagedDependencies.get()
.find("spring-boot").getVersion();
@BeforeClass
public static void createProject() throws IOException {
project = new ProjectCreator().createProject("installer");
}
@Test
public void cleanInstall() {
project.newBuild().forTasks("install").withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run();
}
}

View File

@ -0,0 +1,40 @@
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'spring-boot'
group = 'installer'
version = '0.0.0'
install {
repositories.mavenInstaller {
pom.project {
parent {
groupId 'org.springframework.boot'
artifactId 'spring-boot-starter-parent'
version "${project.bootVersion}"
}
}
}
}
jar {
baseName = 'installer'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile "org.springframework.boot:spring-boot-starter"
}