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


Java ExplodedArchive类代码示例

本文整理汇总了Java中org.springframework.boot.loader.archive.ExplodedArchive的典型用法代码示例。如果您正苦于以下问题:Java ExplodedArchive类的具体用法?Java ExplodedArchive怎么用?Java ExplodedArchive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExplodedArchive类属于org.springframework.boot.loader.archive包,在下文中一共展示了ExplodedArchive类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createArchive

import org.springframework.boot.loader.archive.ExplodedArchive; //导入依赖的package包/类
protected final Archive createArchive() throws Exception {
	ProtectionDomain protectionDomain = getClass().getProtectionDomain();
	CodeSource codeSource = protectionDomain.getCodeSource();
	URI location = (codeSource == null ? null : codeSource.getLocation().toURI());
	String path = (location == null ? null : location.getSchemeSpecificPart());
	if (path == null) {
		throw new IllegalStateException("Unable to determine code source archive");
	}
	File root = new File(path);
	if (!root.exists()) {
		throw new IllegalStateException(
				"Unable to determine code source archive from " + root);
	}
	return (root.isDirectory() ? new ExplodedArchive(root)
			: new JarFileArchive(root));
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:Launcher.java

示例2: getClassPathArchives

import org.springframework.boot.loader.archive.ExplodedArchive; //导入依赖的package包/类
@Override
protected List<Archive> getClassPathArchives() throws Exception {
	List<Archive> lib = new ArrayList<Archive>();
	for (String path : this.paths) {
		for (Archive archive : getClassPathArchives(path)) {
			if (archive instanceof ExplodedArchive) {
				List<Archive> nested = new ArrayList<Archive>(
						archive.getNestedArchives(new ArchiveEntryFilter()));
				nested.add(0, archive);
				lib.addAll(nested);
			}
			else {
				lib.add(archive);
			}
		}
	}
	addNestedEntries(lib);
	return lib;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:PropertiesLauncher.java

示例3: explodedWarHasOnlyWebInfClassesAndContentsOfWebInfLibOnClasspath

import org.springframework.boot.loader.archive.ExplodedArchive; //导入依赖的package包/类
@Test
public void explodedWarHasOnlyWebInfClassesAndContentsOfWebInfLibOnClasspath()
		throws Exception {
	File warRoot = new File("target/exploded-war");
	FileSystemUtils.deleteRecursively(warRoot);
	warRoot.mkdirs();
	File webInfClasses = new File(warRoot, "WEB-INF/classes");
	webInfClasses.mkdirs();
	File webInfLib = new File(warRoot, "WEB-INF/lib");
	webInfLib.mkdirs();
	File webInfLibFoo = new File(webInfLib, "foo.jar");
	new JarOutputStream(new FileOutputStream(webInfLibFoo)).close();
	WarLauncher launcher = new WarLauncher(new ExplodedArchive(warRoot, true));
	List<Archive> archives = launcher.getClassPathArchives();
	assertThat(archives).hasSize(2);
	assertThat(getUrls(archives)).containsOnly(webInfClasses.toURI().toURL(),
			new URL("jar:" + webInfLibFoo.toURI().toURL() + "!/"));
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:WarLauncherTests.java

示例4: explodedWarHasOnlyWebInfClassesAndContentsOfWebInfLibOnClasspath

import org.springframework.boot.loader.archive.ExplodedArchive; //导入依赖的package包/类
@Test
public void explodedWarHasOnlyWebInfClassesAndContentsOfWebInfLibOnClasspath()
		throws Exception {
	File warRoot = new File("target/exploded-war");
	FileSystemUtils.deleteRecursively(warRoot);
	warRoot.mkdirs();
	File webInfClasses = new File(warRoot, "WEB-INF/classes");
	webInfClasses.mkdirs();
	File webInfLib = new File(warRoot, "WEB-INF/lib");
	webInfLib.mkdirs();
	File webInfLibFoo = new File(webInfLib, "foo.jar");
	new JarOutputStream(new FileOutputStream(webInfLibFoo)).close();

	WarLauncher launcher = new WarLauncher(new ExplodedArchive(warRoot, true));
	List<Archive> archives = launcher.getClassPathArchives();
	assertEquals(2, archives.size());

	assertThat(getUrls(archives), hasItems(webInfClasses.toURI().toURL(),
			new URL("jar:" + webInfLibFoo.toURI().toURL() + "!/")));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:21,代码来源:WarLauncherTests.java

示例5: getNestedArchives

import org.springframework.boot.loader.archive.ExplodedArchive; //导入依赖的package包/类
@Override
public List<Archive> getNestedArchives(EntryFilter ignored) throws IOException {
	try {
		List<Archive> archives = new ArrayList<>(mavenProject.getRuntimeClasspathElements().size());
		for (String dep : mavenProject.getRuntimeClasspathElements()) {
			File file = new File(dep);
			archives.add(file.isDirectory() ? new ExplodedArchive(file) : new JarFileArchive(file));
		}
		return archives;
	}
	catch (DependencyResolutionRequiredException e) {
		throw new IOException("Could not create boot archive", e);
	}

}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:16,代码来源:ConfigurationMetadataDocumentationMojo.java

示例6: addParentClassLoaderEntries

import org.springframework.boot.loader.archive.ExplodedArchive; //导入依赖的package包/类
private void addParentClassLoaderEntries(List<Archive> lib)
		throws IOException, URISyntaxException {
	ClassLoader parentClassLoader = getClass().getClassLoader();
	List<Archive> urls = new ArrayList<Archive>();
	for (URL url : getURLs(parentClassLoader)) {
		if (url.toString().endsWith(".jar") || url.toString().endsWith(".zip")) {
			urls.add(new JarFileArchive(new File(url.toURI())));
		}
		else if (url.toString().endsWith("/*")) {
			String name = url.getFile();
			File dir = new File(name.substring(0, name.length() - 1));
			if (dir.exists()) {
				urls.add(new ExplodedArchive(
						new File(name.substring(0, name.length() - 1)), false));
			}
		}
		else {
			String filename = URLDecoder.decode(url.getFile(), "UTF-8");
			urls.add(new ExplodedArchive(new File(filename)));
		}
	}
	// The parent archive might have a "lib/" directory, meaning we are running from
	// an executable JAR. We add nested entries from there with low priority (i.e. at
	// end).
	addNestedArchivesFromParent(urls);
	for (Archive archive : urls) {
		// But only add them if they are not already included
		if (findArchive(lib, archive) < 0) {
			lib.add(archive);
		}
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:33,代码来源:PropertiesLauncher.java

示例7: resolveAsArchive

import org.springframework.boot.loader.archive.ExplodedArchive; //导入依赖的package包/类
private Archive resolveAsArchive(Resource app) throws IOException {
		File moduleFile = app.getFile();
		return moduleFile.isDirectory() ? new ExplodedArchive(moduleFile) : new JarFileArchive(moduleFile);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:5,代码来源:BootApplicationConfigurationMetadataResolver.java

示例8: resolveAsArchive

import org.springframework.boot.loader.archive.ExplodedArchive; //导入依赖的package包/类
private Archive resolveAsArchive(Resource app) throws IOException {
	File moduleFile = app.getFile();
	return moduleFile.isDirectory() ? new ExplodedArchive(moduleFile) : new JarFileArchive(moduleFile);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:5,代码来源:BootApplicationConfigurationMetadataResolver.java


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