org.springframework.boot.loader.thin.ArchiveUtils Java Examples

The following examples show how to use org.springframework.boot.loader.thin.ArchiveUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProcessLauncherState.java    From spring-boot-graal-feature with Apache License 2.0 5 votes vote down vote up
protected String getClasspath(boolean includeTargetClasses) {
	if (this.classpath == null) {
		PathResolver resolver = new PathResolver(DependencyResolver.instance());
		Archive root = ArchiveUtils.getArchive(ProcessLauncherState.class);
		List<Archive> resolved = resolver.resolve(root, name, profiles);
		StringBuilder builder = new StringBuilder();
		if (includeTargetClasses) {
			builder.append(new File("target/classes").getAbsolutePath());
		}
		else {
			builder.append(new File("target/orm-0.0.1.BUILD-SNAPSHOT.jar")
					.getAbsolutePath());
		}
		try {
			for (Archive archive : resolved) {
				if (archive.getUrl().equals(root.getUrl())) {
					continue;
				}
				if (builder.length() > 0) {
					builder.append(File.pathSeparator);
				}
				builder.append(file(archive.getUrl().toString()));
			}
		}
		catch (MalformedURLException e) {
			throw new IllegalStateException("Cannot find archive", e);
		}
		log.debug("Classpath: " + builder);
		this.classpath = builder.toString();
	}
	return this.classpath;
}
 
Example #2
Source File: LauncherAppDeployerTests.java    From spring-cloud-cli with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void skip() {
	try {
		resource = "maven://org.springframework.cloud.launcher:spring-cloud-launcher-configserver:"
				+ new DeployerApplication().getVersion();
		ArchiveUtils.getArchiveRoot(ArchiveUtils.getArchive(resource));
	}
	catch (Exception e) {
		Assume.assumeNoException(
				"Could not locate jar for tests. Please build spring-cloud-cli locally first.",
				e);
	}
}
 
Example #3
Source File: LauncherAppDeployerTests.java    From spring-cloud-cli with Apache License 2.0 5 votes vote down vote up
private String deploy(String jarName, String deployment, String application, String... args)
		throws Exception {
	Resource resource = new FileSystemResource(
			ArchiveUtils.getArchiveRoot(ArchiveUtils.getArchive(jarName)));
	AppDefinition definition = new AppDefinition(resource.getFilename(),
			properties(application));
	AppDeploymentRequest request = new AppDeploymentRequest(definition, resource,
			properties(deployment), Arrays.asList(args));
	String deployed = deployer.deploy(request);
	return deployed;
}