當前位置: 首頁>>代碼示例>>Java>>正文


Java Resource.getIncludes方法代碼示例

本文整理匯總了Java中org.apache.maven.model.Resource.getIncludes方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.getIncludes方法的具體用法?Java Resource.getIncludes怎麽用?Java Resource.getIncludes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.maven.model.Resource的用法示例。


在下文中一共展示了Resource.getIncludes方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFilesToCopy

import org.apache.maven.model.Resource; //導入方法依賴的package包/類
/**
 * Returns a list of filenames that should be copied over to the destination directory.
 *
 * @param resource the resource to be scanned
 * @return the array of filenames, relative to the sourceDir
 */
private String[] getFilesToCopy( Resource resource )
{
    // CHECKSTYLE_OFF: LineLength
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir( resource.getDirectory() );
    if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() )
    {
        scanner.setIncludes( (String[]) resource.getIncludes().toArray( new String[resource.getIncludes().size()] ) );
    }
    else
    {
        scanner.setIncludes( DEFAULT_INCLUDES );
    }
    if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() )
    {
        scanner.setExcludes( (String[]) resource.getExcludes().toArray( new String[resource.getExcludes().size()] ) );
    }

    scanner.addDefaultExcludes();

    scanner.scan();

    return scanner.getIncludedFiles();
    // CHECKSTYLE_ON: LineLength
}
 
開發者ID:zhegexiaohuozi,項目名稱:maven-seimicrawler-plugin,代碼行數:32,代碼來源:WarProjectPackagingTask.java

示例2: getShortDescription

import org.apache.maven.model.Resource; //導入方法依賴的package包/類
@Override
@Messages({
    "# {0} - directory path",
    "TIP_Resource1=<html>Resource directory defined in POM.<br><i>Directory: </i><b>{0}</b><br>", 
    "# {0} - maven resource target path",
    "TIP_Resource2=<i>Target Path: </i><b>{0}</b><br>", 
    "# {0} - boolean value",
    "TIP_Resource6=<b><i>Filtering: </i>{0}. Please note that some IDE features rely on non-filtered content only.</b><br>", 
    "# {0} - includes string value",
    "TIP_Resource3=<i>Includes: </i><b>{0}</b><br>", 
    "# {0} - excludes string value",
    "TIP_Resource4=<i>Excludes: </i><b>{0}</b><br>", 
    "# {0} - directory path",
    "TIP_Resource5=<html>Configuration Directory<br><i>Directory: </i><b>{0}</b><br>"})
public String getShortDescription() {
    if (group.getResource() != null) {
        Resource rs = group.getResource();
        String str = TIP_Resource1(rs.getDirectory());
        if (rs.getTargetPath() != null) {
            str = str + TIP_Resource2(rs.getTargetPath());
        }
        if (rs.isFiltering()) {
            str = str + TIP_Resource6(rs.isFiltering());
        }
        if (rs.getIncludes() != null && rs.getIncludes().size() > 0) {
            str = str + TIP_Resource3(Arrays.toString(rs.getIncludes().toArray()));
        }
        if (rs.getExcludes() != null && rs.getExcludes().size() > 0) {
            str = str + TIP_Resource4(Arrays.toString(rs.getExcludes().toArray()));
        }
        return str;
    } else {
        return  TIP_Resource5(FileUtil.getFileDisplayName(group.getRootFolder()));
     }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:36,代碼來源:OthersRootChildren.java

示例3: visitBuildResource

import org.apache.maven.model.Resource; //導入方法依賴的package包/類
private void visitBuildResource( ModelVisitor visitor, Resource resource )
{
    List<String> includes = resource.getIncludes();
    if ( includes != null )
    {
        ListIterator<String> includeIterator = includes.listIterator();
        while ( includeIterator.hasNext() )
        {
            String include = includeIterator.next();
            visitor.visitBuildResourceInclude( include );
            include = visitor.replaceBuildResourceInclude( include );
            if ( include == null )
                includeIterator.remove();
            else
                includeIterator.set( include );
        }
    }

    List<String> excludes = resource.getExcludes();
    if ( excludes != null )
    {
        ListIterator<String> excludeIterator = excludes.listIterator();
        while ( excludeIterator.hasNext() )
        {
            String exclude = excludeIterator.next();
            visitor.visitBuildResourceExclude( exclude );
            exclude = visitor.replaceBuildResourceExclude( exclude );
            if ( exclude == null )
                excludeIterator.remove();
            else
                excludeIterator.set( exclude );
        }
    }
}
 
開發者ID:fedora-java,項目名稱:xmvn,代碼行數:35,代碼來源:DefaultModelProcessor.java

示例4: visitBuildTestResource

import org.apache.maven.model.Resource; //導入方法依賴的package包/類
private void visitBuildTestResource( ModelVisitor visitor, Resource resource )
{
    List<String> includes = resource.getIncludes();
    if ( includes != null )
    {
        ListIterator<String> includeIterator = includes.listIterator();
        while ( includeIterator.hasNext() )
        {
            String include = includeIterator.next();
            visitor.visitBuildTestResourceInclude( include );
            include = visitor.replaceBuildTestResourceInclude( include );
            if ( include == null )
                includeIterator.remove();
            else
                includeIterator.set( include );
        }
    }

    List<String> excludes = resource.getExcludes();
    if ( excludes != null )
    {
        ListIterator<String> excludeIterator = excludes.listIterator();
        while ( excludeIterator.hasNext() )
        {
            String exclude = excludeIterator.next();
            visitor.visitBuildTestResourceExclude( exclude );
            exclude = visitor.replaceBuildTestResourceExclude( exclude );
            if ( exclude == null )
                excludeIterator.remove();
            else
                excludeIterator.set( exclude );
        }
    }
}
 
開發者ID:fedora-java,項目名稱:xmvn,代碼行數:35,代碼來源:DefaultModelProcessor.java

示例5: visitProfileBuildResource

import org.apache.maven.model.Resource; //導入方法依賴的package包/類
private void visitProfileBuildResource( ModelVisitor visitor, Resource resource )
{
    List<String> includes = resource.getIncludes();
    if ( includes != null )
    {
        ListIterator<String> includeIterator = includes.listIterator();
        while ( includeIterator.hasNext() )
        {
            String include = includeIterator.next();
            visitor.visitProfileBuildResourceInclude( include );
            include = visitor.replaceProfileBuildResourceInclude( include );
            if ( include == null )
                includeIterator.remove();
            else
                includeIterator.set( include );
        }
    }

    List<String> excludes = resource.getExcludes();
    if ( excludes != null )
    {
        ListIterator<String> excludeIterator = excludes.listIterator();
        while ( excludeIterator.hasNext() )
        {
            String exclude = excludeIterator.next();
            visitor.visitProfileBuildResourceExclude( exclude );
            exclude = visitor.replaceProfileBuildResourceExclude( exclude );
            if ( exclude == null )
                excludeIterator.remove();
            else
                excludeIterator.set( exclude );
        }
    }
}
 
開發者ID:fedora-java,項目名稱:xmvn,代碼行數:35,代碼來源:DefaultModelProcessor.java

示例6: visitProfileBuildTestResource

import org.apache.maven.model.Resource; //導入方法依賴的package包/類
private void visitProfileBuildTestResource( ModelVisitor visitor, Resource resource )
{
    List<String> includes = resource.getIncludes();
    if ( includes != null )
    {
        ListIterator<String> includeIterator = includes.listIterator();
        while ( includeIterator.hasNext() )
        {
            String include = includeIterator.next();
            visitor.visitProfileBuildTestResourceInclude( include );
            include = visitor.replaceProfileBuildTestResourceInclude( include );
            if ( include == null )
                includeIterator.remove();
            else
                includeIterator.set( include );
        }
    }

    List<String> excludes = resource.getExcludes();
    if ( excludes != null )
    {
        ListIterator<String> excludeIterator = excludes.listIterator();
        while ( excludeIterator.hasNext() )
        {
            String exclude = excludeIterator.next();
            visitor.visitProfileBuildTestResourceExclude( exclude );
            exclude = visitor.replaceProfileBuildTestResourceExclude( exclude );
            if ( exclude == null )
                excludeIterator.remove();
            else
                excludeIterator.set( exclude );
        }
    }
}
 
開發者ID:fedora-java,項目名稱:xmvn,代碼行數:35,代碼來源:DefaultModelProcessor.java

示例7: findResource

import org.apache.maven.model.Resource; //導入方法依賴的package包/類
private Tuple findResource(List<Resource> resources, Project prj, NbMavenProject nbproj, FileObject child, boolean test) {
    LOG.log(Level.FINE, "findResource for {0}", child.getPath());        
    if (resources == null) {
        LOG.log(Level.FINE, "findResource for {0} : No Resources", child.getPath());
        return null;
    }
    FileObject target;
    //now figure the destination output folder
    File fil = nbproj.getOutputDirectory(test);
    File stamp = new File(fil, CosChecker.NB_COS);
    if (stamp.exists()) {
        target = FileUtil.toFileObject(fil);
    } else {
        LOG.log(Level.FINE, "findResource for {0} : No Stamp", child.getPath());
        // no compile on save stamp, means no copying, classes don't get copied/compiled either.
        return null;
    }
    
    logResources(child, resources);

    resourceLoop:
    for (Resource res : resources) {
        String dir = res.getDirectory();
        if (dir == null) {
            continue;
        }
        URI uri = FileUtilities.getDirURI(prj.getProjectDirectory(), dir);
        FileObject fo = FileUtil.toFileObject(Utilities.toFile(uri));
        if (fo != null && FileUtil.isParentOf(fo, child)) {
            String path = FileUtil.getRelativePath(fo, child);
            //now check includes and excludes
            List<String> incls = res.getIncludes();
            if (incls.isEmpty()) {
                incls = Arrays.asList(FilteredResourcesCoSSkipper.DEFAULT_INCLUDES);
            }
            boolean included = false;
            for (String incl : incls) {
                if (DirectoryScanner.match(incl, path)) {
                    included = true;
                    break;
                }
            }
            if (!included) {
                LOG.log(Level.FINE, "findResource for {0} : Not included {1}, {2} ", new Object[] {child.getPath(), included, res});
                if(res.isFiltering()) {
                    continue;
                } else {
                    break; 
                }
            }
            List<String> excls = new ArrayList<String>(res.getExcludes());
            excls.addAll(Arrays.asList(DirectoryScanner.DEFAULTEXCLUDES));
            for (String excl : excls) {
                if (DirectoryScanner.match(excl, path)) {
                    LOG.log(Level.FINER, "findResource for {0} : Excluded {1}, {2} ", new Object[] {child.getPath(), included, res});
                    continue resourceLoop;
                }
            }
            LOG.log(Level.FINE, "findResource for {0} : Returns {1}, {2}, {3} ", new Object[] {child.getPath(), res, fo.getPath(), target});
            return new Tuple(res, fo, target);
        } else {
            LOG.log(Level.FINE, "findResource {0} does not apply to file {1}", new Object[]{res, child.getPath()});
        }
    }
    LOG.log(Level.FINE, "findResource for {0} : Retuerns Null", child.getPath());
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:68,代碼來源:CopyResourcesOnSave.java

示例8: copyResources

import org.apache.maven.model.Resource; //導入方法依賴的package包/類
private void copyResources() throws MojoExecutionException {
    	
    	//The following code was taken from the maven bundle plugin and updated suit the purpose
    	List<Resource> resources = project.getResources();
		for (Resource resource : resources){
			String sourcePath = resource.getDirectory();
			if (new File(sourcePath).exists()){
				DirectoryScanner scanner = new DirectoryScanner();
				scanner.setBasedir( resource.getDirectory() );
				if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() ){
					scanner.setIncludes((String[])resource.getIncludes().toArray(new String[]{}));
				}else{
					scanner.setIncludes(new String[]{"**/**"});
				}

				List<String> excludes = resource.getExcludes();
				if (excludes != null && !excludes.isEmpty()){
					scanner.setExcludes((String[])excludes.toArray(new String[]{}));
				}
				
				scanner.addDefaultExcludes();
				scanner.scan();
				
				List<String> includedFiles = Arrays.asList( scanner.getIncludedFiles() );
				getLog().info("   " + resource.getDirectory());
				for (String name: includedFiles){
					File fromPath=new File(sourcePath,name);
					File toPath=new File(FOLDER_FEATURES_FEATURE,name);
					    
					try {
						if (fromPath.isDirectory() && !toPath.exists()){
							toPath.mkdirs();
						}else{
							FileManagementUtil.copy(fromPath, toPath);
						}
					} catch (IOException e) {
						throw new MojoExecutionException("Unable copy resources: " + resource.getDirectory(), e);
					}
				}
			}
		}
    	
//        List resources = project.getResources();
//        if (resources != null) {
//            getLog().info("Copying resources");
//            for (Object obj : resources) {
//                if (obj instanceof Resource) {
//                    Resource resource = (Resource) obj;
//                    try {
//                        File resourceFolder = new File(resource.getDirectory());
//                        if (resourceFolder.exists()) {
//                            getLog().info("   " + resource.getDirectory());
//                            FileManagementUtil.copyDirectory(resourceFolder, FOLDER_FEATURES_FEATURE);
//                        }
//                    } catch (IOException e) {
//                        throw new MojoExecutionException("Unable copy resources: " + resource.getDirectory(), e);
//                    }
//                }
//            }
//        }
    }
 
開發者ID:wso2,項目名稱:maven-tools,代碼行數:62,代碼來源:FeatureGenMojo.java


注:本文中的org.apache.maven.model.Resource.getIncludes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。