org.codehaus.plexus.resource.loader.FileResourceLoader Java Examples
The following examples show how to use
org.codehaus.plexus.resource.loader.FileResourceLoader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractXmlMojo.java From xml-maven-plugin with Apache License 2.0 | 5 votes |
protected ResourceManager getLocator() { if ( !locatorInitialized ) { locator.addSearchPath( FileResourceLoader.ID, getBasedir().getAbsolutePath() ); locatorInitialized = true; } return locator; }
Example #2
Source File: AbstractXmlMojoTestCase.java From xml-maven-plugin with Apache License 2.0 | 5 votes |
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; }
Example #3
Source File: AbstractCamelKafkaConnectorMojo.java From camel-kafka-connector with Apache License 2.0 | 4 votes |
protected void configureResourceManager() { rm.setOutputDirectory(new File(project.getBuild().getDirectory())); File dir = project.getFile().getParentFile(); rm.addSearchPath(FileResourceLoader.ID, dir.getAbsolutePath()); rm.addSearchPath("url", ""); }