Search in sources :

Example 46 with DirectoryScanner

use of org.codehaus.plexus.util.DirectoryScanner in project tycho by eclipse.

the class AbstractOsgiCompilerMojo method scanBootclasspath.

private String scanBootclasspath(String javaHome, Xpp3Dom[] includes, Xpp3Dom excludeParent) {
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(javaHome);
    scanner.setIncludes(getValues(includes));
    if (excludeParent != null) {
        Xpp3Dom[] excludes = excludeParent.getChildren("exclude");
        if (excludes.length > 0) {
            scanner.setExcludes(getValues(excludes));
        }
    }
    scanner.scan();
    StringBuilder bootClassPath = new StringBuilder();
    String[] includedFiles = scanner.getIncludedFiles();
    for (int i = 0; i < includedFiles.length; i++) {
        if (i > 0) {
            bootClassPath.append(File.pathSeparator);
        }
        bootClassPath.append(new File(javaHome, includedFiles[i]).getAbsolutePath());
    }
    return bootClassPath.toString();
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) DirectoryScanner(org.codehaus.plexus.util.DirectoryScanner) File(java.io.File)

Aggregations

DirectoryScanner (org.codehaus.plexus.util.DirectoryScanner)46 File (java.io.File)31 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)12 IOException (java.io.IOException)9 ArrayList (java.util.ArrayList)7 FileInputStream (java.io.FileInputStream)4 FileOutputStream (java.io.FileOutputStream)4 InputStream (java.io.InputStream)4 Path (java.nio.file.Path)4 LinkedHashSet (java.util.LinkedHashSet)4 HashSet (java.util.HashSet)3 BufferedInputStream (java.io.BufferedInputStream)2 BufferedOutputStream (java.io.BufferedOutputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 OutputStream (java.io.OutputStream)2 UncheckedIOException (java.io.UncheckedIOException)2 Arrays (java.util.Arrays)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 Properties (java.util.Properties)2