|
|
|
@ -16,48 +16,49 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.gradle; |
|
|
|
package org.springframework.boot.gradle; |
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.assertNotNull; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.jar.JarFile; |
|
|
|
import java.util.jar.JarFile; |
|
|
|
|
|
|
|
|
|
|
|
import org.gradle.tooling.ProjectConnection; |
|
|
|
import org.gradle.tooling.ProjectConnection; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
import org.springframework.boot.dependency.tools.ManagedDependencies; |
|
|
|
import org.springframework.boot.dependency.tools.ManagedDependencies; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.assertNotNull; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Tests for using the Gradle plugin's support for installing artifacts |
|
|
|
* Tests for using the Gradle plugin's support for installing artifacts |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Dave Syer |
|
|
|
* @author Dave Syer |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class ClassifierTests { |
|
|
|
public class ClassifierTests { |
|
|
|
|
|
|
|
|
|
|
|
private ProjectConnection project; |
|
|
|
private ProjectConnection project; |
|
|
|
|
|
|
|
|
|
|
|
private static final String BOOT_VERSION = ManagedDependencies.get().find( |
|
|
|
private static final String BOOT_VERSION = ManagedDependencies.get() |
|
|
|
"spring-boot").getVersion(); |
|
|
|
.find("spring-boot").getVersion(); |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void classifierInBootTask() throws Exception { |
|
|
|
public void classifierInBootTask() throws Exception { |
|
|
|
project = new ProjectCreator().createProject("classifier"); |
|
|
|
this.project = new ProjectCreator().createProject("classifier"); |
|
|
|
project.newBuild().forTasks("build").withArguments( |
|
|
|
this.project.newBuild().forTasks("build") |
|
|
|
"-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); |
|
|
|
.withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); |
|
|
|
checkFilesExist("classifier"); |
|
|
|
checkFilesExist("classifier"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void classifierInBootExtension() throws Exception { |
|
|
|
public void classifierInBootExtension() throws Exception { |
|
|
|
project = new ProjectCreator().createProject("classifier-extension"); |
|
|
|
this.project = new ProjectCreator().createProject("classifier-extension"); |
|
|
|
project.newBuild().forTasks("build").withArguments( |
|
|
|
this.project.newBuild().forTasks("build") |
|
|
|
"-PbootVersion=" + BOOT_VERSION, "--stacktrace", "--info").run(); |
|
|
|
.withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace", "--info") |
|
|
|
|
|
|
|
.run(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void checkFilesExist(String name) throws Exception { |
|
|
|
private void checkFilesExist(String name) throws Exception { |
|
|
|
JarFile jar = new JarFile("target/" + name + "/build/libs/" + name + ".jar"); |
|
|
|
JarFile jar = new JarFile("target/" + name + "/build/libs/" + name + ".jar"); |
|
|
|
assertNotNull(jar.getManifest()); |
|
|
|
assertNotNull(jar.getManifest()); |
|
|
|
jar.close(); |
|
|
|
jar.close(); |
|
|
|
jar = new JarFile("target/" + name + "/build/libs/" + name + "-exec.jar"); |
|
|
|
jar = new JarFile("target/" + name + "/build/libs/" + name + "-exec.jar"); |
|
|
|
assertNotNull(jar.getManifest()); |
|
|
|
assertNotNull(jar.getManifest()); |
|
|
|
jar.close(); |
|
|
|
jar.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|