本文整理匯總了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;
}
示例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;
}
示例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 );
}
}
}
}
}