@SuppressWarnings("unchecked") public List<URL> build() throws MalformedURLException { List<URL> cp = new ArrayList<>(); cp.addAll(resources(project.getResources())); cp.add(new File(project.getBuild().getOutputDirectory()).toURI().toURL()); cp.addAll(jars(project.getArtifacts())); return cp; }
return null; List<File> resources = resources(project.getResources()); resources.add(0, new File(project.getBuild().getSourceDirectory())); List<Path> paths = resources.stream()
/** * Returns true if there is at least one resource folder inside the project. * * @param project * @return */ public static boolean hasResourceFolders( MavenProject project ){ List<Resource> resources = project.getResources(); for ( Resource res : resources ){ if ( FileUtils.fileExists( res.getDirectory() ) ){ return true; } } return false; }
String includes; String excludes; List allResources = project.getResources(); allResources.addAll( project.getTestResources() );
appcp.addAll(resources(mavenProject.getResources()));
@Override protected List<Resource> getProjectResources() { return project.getResources(); } }
public List<Resource> getResources() { return wrapped.getResources(); }
@Override @SuppressWarnings("unchecked") protected java.util.Set<String> getClasspathElements( final java.util.Set<String> result) { List<Resource> resources = project.getResources(); if( resources!=null ) { for( Resource r : resources ) { result.add(r.getDirectory()); } } result.addAll( classpathElements ); return result; }
public List getResources() { return getDelegate().getResources(); }
/** * Add the directory as a resource of the given project. * * @param dir the directory to add * @param project the project to update * @param includes the includes of the resource * @return {@code true} if the resources was added (not already existing) */ public static boolean addResourceDir( File dir, MavenProject project, String... includes ) { List<?> resources = project.getResources(); return addResourceDir( dir, project, resources, includes ); }
/** * Add the directory as a resource of the given project. * * @param dir the directory to add * @param project the project to update * @param includes the includes of the resource * @return {@code true} if the resources was added (not already existing) * @since 1.1.1 */ public static boolean addResourceDir(File dir, MavenProject project, String... includes) { List<?> resources = project.getResources(); boolean added = addResourceDir(dir, project, resources, includes); return added; }
/** * Add the directory as a resource of the given project. * * @param dir the directory to add * @param project the project to update * @param includes the includes of the resource * @return {@code true} if the resources was added (not already existing) * @since 1.1.1 */ public static boolean addResourceDir(File dir, MavenProject project, String... includes) { List<?> resources = project.getResources(); boolean added = addResourceDir(dir, project, resources, includes); return added; }
private void addResources(List<URL> urls) throws IOException { if (this.addResources) { for (Resource resource : this.project.getResources()) { File directory = new File(resource.getDirectory()); urls.add(directory.toURI().toURL()); FileUtils.removeDuplicatesFromOutputDirectory(this.classesDirectory, directory); } } }
@Override protected List<File> getSources() { if (sources != null) { return sources; } List<File> sources = Lists.newArrayList(); for (String source : mavenProject.getCompileSourceRoots()) { sources.add(new File(source)); } for (Resource res : mavenProject.getResources()) { sources.add(new File(res.getDirectory())); } return sources; }
private void writeTaglibXml() throws MojoExecutionException { try { File taglibsXml = new File(project.getBasedir(), "target/taglib.xml"); taglibsXml.getParentFile().mkdirs(); Tags tags = TXW.create(Tags.class,new StreamSerializer(new FileOutputStream(taglibsXml))); for(Resource res : (List<Resource>)project.getResources()) scanTagLibs(new File(res.getDirectory()),"",tags); tags.commit(); } catch (IOException e) { throw new MojoExecutionException("Failed to generate taglibs.xml",e); } }
public URI[] getResources(boolean test) { List<URI> toRet = new ArrayList<URI>(); List res = test ? getOriginalMavenProject().getTestResources() : getOriginalMavenProject().getResources(); Iterator it = res.iterator(); while (it.hasNext()) { Resource elem = (Resource) it.next(); URI uri = FileUtilities.getDirURI(getProjectDirectory(), elem.getDirectory()); // if (new File(uri).exists()) { toRet.add(uri); // } } return toRet.toArray(new URI[toRet.size()]); }
public void execute() throws MojoExecutionException, MojoFailureException { L10nProgress r = new L10nProgress(); for( Resource root : (Collection<Resource>)project.getResources() ) { r.parseRecursively(new File(root.getDirectory())); } System.out.println(r.toHatena()); } }
public void execute() throws MojoExecutionException { try { copyAllResources(project.getResources()); copyAllResources(project.getTestResources()); } catch (Exception ex) { getLog().debug("Exception thrown while copying files. Reason:", ex); throw new MojoExecutionException( "NPANDAY-1500-005: Failed to copy config files.", ex ); } }
@Override public String[] getAdditionalClasspathElements() { if (computedAdditionalClasspathElements == null) { List<Resource> resources = new ArrayList<>(); resources.addAll(getProject().getResources()); resources.addAll(getProject().getTestResources()); List<String> sourceRoots = new ArrayList<>(); sourceRoots.addAll(getProject().getCompileSourceRoots()); sourceRoots.addAll(getProject().getTestCompileSourceRoots()); List<String> filteredSourceRoots = SourcesAsResourcesHelper.filterSourceRoots(getLog(), resources, sourceRoots); filteredSourceRoots.addAll(Arrays.asList(super.getAdditionalClasspathElements())); computedAdditionalClasspathElements = sourceRoots.toArray(new String[filteredSourceRoots.size()]); } return computedAdditionalClasspathElements; }
protected List<Resource> getResources(boolean istest) { return istest ? project.getOriginalMavenProject().getTestResources() : project.getOriginalMavenProject().getResources(); }