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


Java FileResourceLoader類代碼示例

本文整理匯總了Java中org.codehaus.plexus.resource.loader.FileResourceLoader的典型用法代碼示例。如果您正苦於以下問題:Java FileResourceLoader類的具體用法?Java FileResourceLoader怎麽用?Java FileResourceLoader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FileResourceLoader類屬於org.codehaus.plexus.resource.loader包,在下文中一共展示了FileResourceLoader類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getLocator

import org.codehaus.plexus.resource.loader.FileResourceLoader; //導入依賴的package包/類
protected ResourceManager getLocator()
{
    if ( !locatorInitialized )
    {
        locator.addSearchPath( FileResourceLoader.ID, getBasedir().getAbsolutePath() );
        locatorInitialized = true;
    }
    return locator;
}
 
開發者ID:mojohaus,項目名稱:xml-maven-plugin,代碼行數:10,代碼來源:AbstractXmlMojo.java

示例2: newMojo

import org.codehaus.plexus.resource.loader.FileResourceLoader; //導入依賴的package包/類
protected AbstractXmlMojo newMojo( String pDir )
        throws Exception
    {
        File testPom = new File( new File( getBasedir(), pDir ), "pom.xml" );
        
        MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest();
        ProjectBuildingRequest buildingRequest = executionRequest.getProjectBuildingRequest();
        ProjectBuilder projectBuilder = this.lookup(ProjectBuilder.class);
        MavenProject project = projectBuilder.build(testPom, buildingRequest).getProject();
//        final Build build = new Build();
//        build.setDirectory( "target" );
//        project.setBuild(build);
        project.getBuild().setDirectory("target");
        AbstractXmlMojo vm = (AbstractXmlMojo) lookupConfiguredMojo(project, getGoal());
        setVariableValueToObject( vm, "basedir", new File( getBasedir(), pDir ) );
        final Log log = new SilentLog();
        DefaultResourceManager rm = new DefaultResourceManager();
        setVariableValueToObject( rm, "logger", log );
        setVariableValueToObject( vm, "locator", rm );
        final Map<String, ResourceLoader> resourceLoaders = new HashMap<String, ResourceLoader>();
        resourceLoaders.put( "file", new FileResourceLoader() );
        resourceLoaders.put( "jar", new JarResourceLoader() );
        resourceLoaders.put( "classloader", new ThreadContextClasspathResourceLoader() );
        URLResourceLoader url = new URLResourceLoader();
        setVariableValueToObject( url, "logger", log );
        resourceLoaders.put( "url", url );
        setVariableValueToObject( rm, "resourceLoaders", resourceLoaders );

//        MavenProjectStub project = new MavenProjectStub()
//        {
//            public Build getBuild()
//            {
//                return build;
//            }
//        };
//        setVariableValueToObject( vm, "project", project );
        return vm;
    }
 
開發者ID:mojohaus,項目名稱:xml-maven-plugin,代碼行數:39,代碼來源:AbstractXmlMojoTestCase.java

示例3: addSupplementalModelArtifacts

import org.codehaus.plexus.resource.loader.FileResourceLoader; //導入依賴的package包/類
private void addSupplementalModelArtifacts()
    throws MojoExecutionException
{
    if ( supplementalModelArtifacts != null && !supplementalModelArtifacts.isEmpty() )
    {
        List<File> artifacts = downloadBundles( supplementalModelArtifacts );

        for ( File artifact : artifacts )
        {
            if ( artifact.isDirectory() )
            {
                locator.addSearchPath( FileResourceLoader.ID, artifact.getAbsolutePath() );
            }
            else
            {
                try
                {
                    locator.addSearchPath( "jar", "jar:" + artifact.toURI().toURL().toExternalForm() );
                }
                catch ( MalformedURLException e )
                {
                    throw new MojoExecutionException( "Could not use jar " + artifact.getAbsolutePath(), e );
                }
            }
        }


    }
}
 
開發者ID:dashie,項目名稱:m2e-plugins,代碼行數:30,代碼來源:ProcessRemoteResourcesMojo.java


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