Java 类org.springframework.boot.loader.tools.Library 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArtifactsLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<String> duplicates = getDuplicates(this.artifacts);
    for (Artifact artifact : this.artifacts) {
        LibraryScope scope = SCOPES.get(artifact.getScope());
        if (scope != null && artifact.getFile() != null) {
            String name = artifact.getFile().getName();
            if (duplicates.contains(name)) {
                this.log.debug("Duplicate found: " + name);
                name = artifact.getGroupId() + "-" + name;
                this.log.debug("Renamed to: " + name);
            }
            callback.library(new Library(name, artifact.getFile(), scope,
                    isUnpackRequired(artifact)));
        }
    }
}
项目:spring-boot-concourse    文件:ArtifactsLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<String> duplicates = getDuplicates(this.artifacts);
    for (Artifact artifact : this.artifacts) {
        LibraryScope scope = SCOPES.get(artifact.getScope());
        if (scope != null && artifact.getFile() != null) {
            String name = artifact.getFile().getName();
            if (duplicates.contains(name)) {
                this.log.debug("Duplicate found: " + name);
                name = artifact.getGroupId() + "-" + name;
                this.log.debug("Renamed to: " + name);
            }
            callback.library(new Library(name, artifact.getFile(), scope,
                    isUnpackRequired(artifact)));
        }
    }
}
项目:cft    文件:JarArchivingUIHandler.java   
protected void bootRepackage(final IPackageFragmentRoot[] roots, File packagedFile) throws CoreException {
    Repackager bootRepackager = new Repackager(packagedFile);
    try {
        bootRepackager.repackage(new Libraries() {

            public void doWithLibraries(LibraryCallback callBack) throws IOException {
                for (IPackageFragmentRoot root : roots) {

                    if (root.isArchive()) {

                        File rootFile = new File(root.getPath().toOSString());
                        if (rootFile.exists()) {
                            callBack.library(new Library(rootFile, LibraryScope.COMPILE));
                        }
                    }
                }
            }
        });
    } catch (IOException e) {
        errorHandler.handleApplicationDeploymentFailure(
                NLS.bind(Messages.JavaCloudFoundryArchiver_ERROR_REPACKAGE_SPRING, e.getMessage()));
    }
}
项目:contestparser    文件:ArtifactsLibraries.java   
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
    Set<String> duplicates = getDuplicates(this.artifacts);
    for (Artifact artifact : this.artifacts) {
        LibraryScope scope = SCOPES.get(artifact.getScope());
        if (scope != null && artifact.getFile() != null) {
            String name = artifact.getFile().getName();
            if (duplicates.contains(name)) {
                this.log.debug("Duplicate found: " + name);
                name = artifact.getGroupId() + "-" + name;
                this.log.debug("Renamed to: " + name);
            }
            callback.library(new Library(name, artifact.getFile(), scope,
                    isUnpackRequired(artifact)));
        }
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArchiveCommand.java   
private void writeJar(File file, Class<?>[] compiledClasses,
        List<MatchedResource> classpathEntries, List<URL> dependencies)
                throws FileNotFoundException, IOException, URISyntaxException {
    final List<Library> libraries;
    JarWriter writer = new JarWriter(file);
    try {
        addManifest(writer, compiledClasses);
        addCliClasses(writer);
        for (Class<?> compiledClass : compiledClasses) {
            addClass(writer, compiledClass);
        }
        libraries = addClasspathEntries(writer, classpathEntries);
    }
    finally {
        writer.close();
    }
    libraries.addAll(createLibraries(dependencies));
    Repackager repackager = new Repackager(file);
    repackager.setMainClass(PackagedSpringApplicationLauncher.class.getName());
    repackager.repackage(new Libraries() {

        @Override
        public void doWithLibraries(LibraryCallback callback) throws IOException {
            for (Library library : libraries) {
                callback.library(library);
            }
        }
    });
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArchiveCommand.java   
private List<Library> createLibraries(List<URL> dependencies)
        throws URISyntaxException {
    List<Library> libraries = new ArrayList<Library>();
    for (URL dependency : dependencies) {
        File file = new File(dependency.toURI());
        libraries.add(new Library(file, getLibraryScope(file)));
    }
    return libraries;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ArchiveCommand.java   
private List<Library> addClasspathEntries(JarWriter writer,
        List<MatchedResource> entries) throws IOException {
    List<Library> libraries = new ArrayList<Library>();
    for (MatchedResource entry : entries) {
        if (entry.isRoot()) {
            libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE));
        }
        else {
            writer.writeEntry(entry.getName(),
                    new FileInputStream(entry.getFile()));
        }
    }
    return libraries;
}
项目:spring-boot-concourse    文件:ArchiveCommand.java   
private void writeJar(File file, Class<?>[] compiledClasses,
        List<MatchedResource> classpathEntries, List<URL> dependencies)
                throws FileNotFoundException, IOException, URISyntaxException {
    final List<Library> libraries;
    JarWriter writer = new JarWriter(file);
    try {
        addManifest(writer, compiledClasses);
        addCliClasses(writer);
        for (Class<?> compiledClass : compiledClasses) {
            addClass(writer, compiledClass);
        }
        libraries = addClasspathEntries(writer, classpathEntries);
    }
    finally {
        writer.close();
    }
    libraries.addAll(createLibraries(dependencies));
    Repackager repackager = new Repackager(file);
    repackager.setMainClass(PackagedSpringApplicationLauncher.class.getName());
    repackager.repackage(new Libraries() {

        @Override
        public void doWithLibraries(LibraryCallback callback) throws IOException {
            for (Library library : libraries) {
                callback.library(library);
            }
        }
    });
}
项目:spring-boot-concourse    文件:ArchiveCommand.java   
private List<Library> createLibraries(List<URL> dependencies)
        throws URISyntaxException {
    List<Library> libraries = new ArrayList<Library>();
    for (URL dependency : dependencies) {
        File file = new File(dependency.toURI());
        libraries.add(new Library(file, getLibraryScope(file)));
    }
    return libraries;
}
项目:spring-boot-concourse    文件:ArchiveCommand.java   
private List<Library> addClasspathEntries(JarWriter writer,
        List<MatchedResource> entries) throws IOException {
    List<Library> libraries = new ArrayList<Library>();
    for (MatchedResource entry : entries) {
        if (entry.isRoot()) {
            libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE));
        }
        else {
            writer.writeEntry(entry.getName(),
                    new FileInputStream(entry.getFile()));
        }
    }
    return libraries;
}
项目:contestparser    文件:ArchiveCommand.java   
private void writeJar(File file, Class<?>[] compiledClasses,
        List<MatchedResource> classpathEntries, List<URL> dependencies)
                throws FileNotFoundException, IOException, URISyntaxException {
    final List<Library> libraries;
    JarWriter writer = new JarWriter(file);
    try {
        addManifest(writer, compiledClasses);
        addCliClasses(writer);
        for (Class<?> compiledClass : compiledClasses) {
            addClass(writer, compiledClass);
        }
        libraries = addClasspathEntries(writer, classpathEntries);
    }
    finally {
        writer.close();
    }
    libraries.addAll(createLibraries(dependencies));
    Repackager repackager = new Repackager(file);
    repackager.setMainClass(PackagedSpringApplicationLauncher.class.getName());
    repackager.repackage(new Libraries() {

        @Override
        public void doWithLibraries(LibraryCallback callback) throws IOException {
            for (Library library : libraries) {
                callback.library(library);
            }
        }
    });
}
项目:contestparser    文件:ArchiveCommand.java   
private List<Library> createLibraries(List<URL> dependencies)
        throws URISyntaxException {
    List<Library> libraries = new ArrayList<Library>();
    for (URL dependency : dependencies) {
        File file = new File(dependency.toURI());
        libraries.add(new Library(file, getLibraryScope(file)));
    }
    return libraries;
}
项目:contestparser    文件:ArchiveCommand.java   
private List<Library> addClasspathEntries(JarWriter writer,
        List<MatchedResource> entries) throws IOException {
    List<Library> libraries = new ArrayList<Library>();
    for (MatchedResource entry : entries) {
        if (entry.isRoot()) {
            libraries.add(new Library(entry.getFile(), LibraryScope.COMPILE));
        }
        else {
            writer.writeEntry(entry.getName(),
                    new FileInputStream(entry.getFile()));
        }
    }
    return libraries;
}