All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.atlassian.bamboo.specs.maven.BambooSpecsFileScanner Maven / Gradle / Ivy

There is a newer version: 10.1.0
Show newest version
package com.atlassian.bamboo.specs.maven;

import org.apache.maven.plugin.logging.Log;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Collection;

public final class BambooSpecsFileScanner {
    private BambooSpecsFileScanner() {
    }

    public static Collection getClassFiles(final Log log, final Path root) throws IOException {
        final Collection classFiles = new ArrayList<>();
        Files.walkFileTree(root, new SimpleFileVisitor() {
            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                if (file.toString().endsWith(".class")) {
                    log.debug("Adding " + file + " to scan candidates");
                    classFiles.add(root.relativize(file));
                }
                return super.visitFile(file, attrs);
            }
        });
        return classFiles;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy