本文整理汇总了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 );
}
}
}
}
}