Search in sources :

Example 6 with Resource

use of org.apache.maven.model.Resource in project camel by apache.

the class SpringBootAutoConfigurationMojo method findComponentNames.

private List<String> findComponentNames() {
    List<String> componentNames = new ArrayList<String>();
    for (Resource r : project.getBuild().getResources()) {
        File f = new File(r.getDirectory());
        if (!f.exists()) {
            f = new File(project.getBasedir(), r.getDirectory());
        }
        f = new File(f, "META-INF/services/org/apache/camel/component");
        if (f.exists() && f.isDirectory()) {
            File[] files = f.listFiles();
            if (files != null) {
                for (File file : files) {
                    // skip directories as there may be a sub .resolver directory
                    if (file.isDirectory()) {
                        continue;
                    }
                    String name = file.getName();
                    if (name.charAt(0) != '.') {
                        componentNames.add(name);
                    }
                }
            }
        }
    }
    return componentNames;
}
Also used : ArrayList(java.util.ArrayList) Resource(org.apache.maven.model.Resource) File(java.io.File)

Example 7 with Resource

use of org.apache.maven.model.Resource in project camel by apache.

the class SpringBootAutoConfigurationMojo method findLanguageNames.

private List<String> findLanguageNames() {
    List<String> languageNames = new ArrayList<String>();
    for (Resource r : project.getBuild().getResources()) {
        File f = new File(r.getDirectory());
        if (!f.exists()) {
            f = new File(project.getBasedir(), r.getDirectory());
        }
        f = new File(f, "META-INF/services/org/apache/camel/language");
        if (f.exists() && f.isDirectory()) {
            File[] files = f.listFiles();
            if (files != null) {
                for (File file : files) {
                    // skip directories as there may be a sub .resolver directory
                    if (file.isDirectory()) {
                        continue;
                    }
                    String name = file.getName();
                    if (name.charAt(0) != '.') {
                        languageNames.add(name);
                    }
                }
            }
        }
    }
    return languageNames;
}
Also used : ArrayList(java.util.ArrayList) Resource(org.apache.maven.model.Resource) File(java.io.File)

Example 8 with Resource

use of org.apache.maven.model.Resource in project camel by apache.

the class UpdateReadmeMojo method findLanguageNames.

private List<String> findLanguageNames() {
    List<String> languageNames = new ArrayList<String>();
    for (Resource r : project.getBuild().getResources()) {
        File f = new File(r.getDirectory());
        if (!f.exists()) {
            f = new File(project.getBasedir(), r.getDirectory());
        }
        f = new File(f, "META-INF/services/org/apache/camel/language");
        if (f.exists() && f.isDirectory()) {
            File[] files = f.listFiles();
            if (files != null) {
                for (File file : files) {
                    // skip directories as there may be a sub .resolver directory
                    if (file.isDirectory()) {
                        continue;
                    }
                    String name = file.getName();
                    if (name.charAt(0) != '.') {
                        languageNames.add(name);
                    }
                }
            }
        }
    }
    return languageNames;
}
Also used : ArrayList(java.util.ArrayList) Resource(org.apache.maven.model.Resource) File(java.io.File)

Example 9 with Resource

use of org.apache.maven.model.Resource in project camel by apache.

the class UpdateReadmeMojo method findDataFormatNames.

private List<String> findDataFormatNames() {
    List<String> dataFormatNames = new ArrayList<String>();
    for (Resource r : project.getBuild().getResources()) {
        File f = new File(r.getDirectory());
        if (!f.exists()) {
            f = new File(project.getBasedir(), r.getDirectory());
        }
        f = new File(f, "META-INF/services/org/apache/camel/dataformat");
        if (f.exists() && f.isDirectory()) {
            File[] files = f.listFiles();
            if (files != null) {
                for (File file : files) {
                    // skip directories as there may be a sub .resolver directory
                    if (file.isDirectory()) {
                        continue;
                    }
                    String name = file.getName();
                    if (name.charAt(0) != '.') {
                        dataFormatNames.add(name);
                    }
                }
            }
        }
    }
    return dataFormatNames;
}
Also used : ArrayList(java.util.ArrayList) Resource(org.apache.maven.model.Resource) File(java.io.File)

Example 10 with Resource

use of org.apache.maven.model.Resource in project che by eclipse.

the class MavenModelUtil method convertToMavenResource.

private static Resource convertToMavenResource(MavenResource mavenResource) {
    Resource resource = new Resource();
    resource.setDirectory(mavenResource.getDirectory());
    resource.setFiltering(mavenResource.isFiltered());
    resource.setTargetPath(mavenResource.getTargetPath());
    resource.setIncludes(mavenResource.getIncludes());
    resource.setExcludes(mavenResource.getExcludes());
    return resource;
}
Also used : MavenResource(org.eclipse.che.maven.data.MavenResource) Resource(org.apache.maven.model.Resource)

Aggregations

Resource (org.apache.maven.model.Resource)65 File (java.io.File)49 MavenProjectResourcesStub (org.apache.maven.plugins.resources.stub.MavenProjectResourcesStub)17 ArrayList (java.util.ArrayList)16 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)15 IOException (java.io.IOException)11 Properties (java.util.Properties)8 MojoFailureException (org.apache.maven.plugin.MojoFailureException)8 FileInputStream (java.io.FileInputStream)7 List (java.util.List)6 InputStream (java.io.InputStream)5 OutputStream (java.io.OutputStream)5 URL (java.net.URL)5 LinkedList (java.util.LinkedList)4 Map (java.util.Map)4 URLClassLoader (java.net.URLClassLoader)3 Iterator (java.util.Iterator)3 FileOutputStream (java.io.FileOutputStream)2 MalformedURLException (java.net.MalformedURLException)2 HashMap (java.util.HashMap)2