类org.springframework.boot.loader.thin.ArchiveUtils源码实例Demo

下面列出了怎么用org.springframework.boot.loader.thin.ArchiveUtils的API类实例代码及写法,或者点击链接到github查看源代码。

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;
}
 
@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);
	}
}
 
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;
}
 
 类所在包
 类方法
 同包方法