resource.addInclude(targetResourceSpringBeansFile); myProject.addResource(resource);
resName = targetFolder+File.separator+targetFile; resource.addInclude(resName); myProject.addResource(resource); break;
resource.setDirectory(targetResourceDirectory.getAbsolutePath()); if (targetFolder != null) { resource.addInclude(targetFolder+"/*"); } else { resource.addInclude("*");
private Resource scanForResources(File rootFile, Resource root) { File[] files = rootFile.listFiles(); if (files == null) { return root; } for (File f : files) { if (f.isDirectory()) { root = scanForResources(f, root); } else if (!f.getName().endsWith(".java")) { String n = f.getName(); int idx = n.lastIndexOf('.'); if (idx != -1) { n = "**/*" + n.substring(idx); } if (root == null) { root = new Resource(); } if (!root.getIncludes().contains(n)) { root.addInclude(n); } } } return root; }
private void addNonPartialsToResources(final File dir, final Resource resource) throws CodeGenException { if (dir.equals(null)) { throw new CodeGenException("Could not read from directory " + dir.getPath()); } final File[] files = dir.listFiles(); if (files == null) { return; } for(File entry : files) { try { if (entry.isDirectory()) { addNonPartialsToResources(entry, resource); } else if (entry.getName().endsWith(".json") && ProctorUtils.readJsonFromFile(entry).has("tests")) { resource.addInclude(entry.getPath().substring(getTopDirectory().getPath().length() + 1)); } } catch (IOException e) { throw new CodeGenException("Could not read from file " + entry.getName(),e); } } }
public static Deployment getDefaultDeploymentConfiguration(String deployType) { final Deployment result = new Deployment(); final Resource resource = new Resource(); deployType = StringUtils.isEmpty(deployType) ? DEFAULT_DEPLOYTYPE : deployType; resource.setDirectory(DEFAULT_DIRECTORY); resource.addInclude(String.format(DEFAULT_INCLUDE, deployType)); result.setResources(Arrays.asList(resource)); return result; } }
private Resource scanForResources(File rootFile, Resource root) { File[] files = rootFile.listFiles(); if (files == null) { return root; } for (File f : files) { if (f.isDirectory()) { root = scanForResources(f, root); } else if (!f.getName().endsWith(".java")) { String n = f.getName(); int idx = n.lastIndexOf('.'); if (idx != -1) { n = "**/*" + n.substring(idx); } if (root == null) { root = new Resource(); } if (!root.getIncludes().contains(n)) { root.addInclude(n); } } } return root; }
protected Resource createGemsResource(String gemHome) { Resource resource = new Resource(); resource.setDirectory(gemHome); resource.addInclude("bin/*"); resource.addInclude("specifications/*"); resource.addInclude("gems/**"); resource.addExclude("gems/*/test/**"); resource.addExclude("gems/*/tests/**"); resource.addExclude("gems/*/spec/**"); resource.addExclude("gems/*/specs/**"); resource.addExclude("gems/*/features/**"); resource.addExclude("gems/**/*.java"); return resource; }
protected Resource createGemsResource(String gemHome) { Resource resource = new Resource(); resource.setDirectory(gemHome); resource.addInclude("bin/*"); resource.addInclude("specifications/*"); resource.addInclude("gems/**"); resource.addExclude("gems/*/test/**"); resource.addExclude("gems/*/tests/**"); resource.addExclude("gems/*/spec/**"); resource.addExclude("gems/*/specs/**"); resource.addExclude("gems/*/features/**"); resource.addExclude("gems/**/*.java"); return resource; }
@Override protected void executeWithGems() throws MojoExecutionException, ScriptException, IOException, GemException { if ( includeRubyResources != null) { // add it to the classpath so java classes can find the ruby files Resource resource = new Resource(); resource.setDirectory(project.getBasedir().getAbsolutePath()); for( String include: includeRubyResources) { resource.addInclude(include); } if (excludeRubyResources != null) { for( String exclude: excludeRubyResources) { resource.addExclude(exclude); } } addResource(project.getBuild().getResources(), resource); } if (includeBinStubs) { Resource resource = new Resource(); resource.setDirectory(gemsConfig.getBinDirectory().getAbsolutePath()); resource.addInclude("*"); resource.setTargetPath("META-INF/jruby.home/bin"); addResource(project.getBuild().getResources(), resource); } } }
resource.addInclude("*.dml"); getMavenProject().addResource(resource); getMavenProject().addTestResource(resource);
/** * Augments Maven paths with generated resources. */ protected void setupMavenPaths() { getProject().addCompileSourceRoot(getGenerateDirectory().getPath()); // Mark XJC_gen prop files as resources for inclusion to final jar. final Resource generatedResource = new Resource(); generatedResource.setDirectory(getGenerateDirectory().getPath()); generatedResource.addInclude("**/jaxb.properties"); generatedResource.addInclude("**/bgm.ser"); getProject().addResource(generatedResource); if (getEpisode() && getEpisodeFile() != null) { final String episodeFilePath = getEpisodeFile().getAbsolutePath(); final String generatedDirectoryPath = getGenerateDirectory() .getAbsolutePath(); if (episodeFilePath.startsWith(generatedDirectoryPath + File.separator)) { final String path = episodeFilePath .substring(generatedDirectoryPath.length() + 1); final Resource resource = new Resource(); resource.setDirectory(generatedDirectoryPath); resource.addInclude(path); getProject().addResource(resource); } } }
@Override protected void executeWithGems() throws MojoExecutionException, ScriptException, IOException, GemException { if ( includeRubyResources != null) { // add it to the classpath so java classes can find the ruby files Resource resource = new Resource(); resource.setDirectory(project.getBasedir().getAbsolutePath()); for( String include: includeRubyResources) { resource.addInclude(include); } if (excludeRubyResources != null) { for( String exclude: excludeRubyResources) { resource.addExclude(exclude); } } addResource(project.getBuild().getResources(), resource); } if (includeBinStubs) { Resource resource = new Resource(); resource.setDirectory(gemsConfig.getBinDirectory().getAbsolutePath()); resource.addInclude("*"); resource.setTargetPath("META-INF/jruby.home/bin"); addResource(project.getBuild().getResources(), resource); } } }
Resource[] getResources() throws MojoExecutionException { final Resource resourceNonGenerated = new Resource(); resourceNonGenerated.setDirectory(getTopDirectory().getPath()); try { addNonPartialsToResources(getTopDirectory(),resourceNonGenerated); } catch (CodeGenException e) { throw new MojoExecutionException("Couldn't add non partial specifications to resources"); } if (resourceNonGenerated.getIncludes().isEmpty()) { resourceNonGenerated.addExclude("**/*"); } Resource resourceGenerated = new Resource(); final File specificationOutputDir = getSpecificationOutput(); resourceGenerated.setDirectory(specificationOutputDir.getPath()); resourceGenerated.addInclude("**/*.json"); final Resource[] resources = {resourceNonGenerated,resourceGenerated}; return resources; }
/** * Updates XJC's compilePath ans resources and update hyperjaxb2's * resources, that is, *.hbm.xml files and hibernate.config.xml file. * * @param xjcOpts * @throws MojoExecutionException */ protected void setupMavenPaths() { super.setupMavenPaths(); final Resource resource = new Resource(); resource.setDirectory(getGenerateDirectory().getPath()); for (String resourceInclude : resourceIncludes) { resource.addInclude(resourceInclude); } getProject().addResource(resource); if (this.roundtripTestClassName != null) { getProject().addTestCompileSourceRoot( getGenerateDirectory().getPath()); } }
/** * Updates XJC's compilePath ans resources and update hyperjaxb2's * resources, that is, *.hbm.xml files and hibernate.config.xml file. * * @param xjcOpts * @throws MojoExecutionException */ protected void setupMavenPaths() { super.setupMavenPaths(); final Resource resource = new Resource(); resource.setDirectory(getGenerateDirectory().getPath()); for (String resourceInclude : resourceIncludes) { resource.addInclude(resourceInclude); } getProject().addResource(resource); if (this.roundtripTestClassName != null) { getProject().addTestCompileSourceRoot( getGenerateDirectory().getPath()); } }
/** * Updates XJC's compilePath ans resources and update hyperjaxb2's * resources, that is, *.hbm.xml files and hibernate.config.xml file. * * @param xjcOpts * @throws MojoExecutionException */ protected void setupMavenPaths() { super.setupMavenPaths(); final Resource resource = new Resource(); resource.setDirectory(getGenerateDirectory().getPath()); for (String resourceInclude : resourceIncludes) { resource.addInclude(resourceInclude); } getProject().addResource(resource); if (this.roundtripTestClassName != null) { getProject().addTestCompileSourceRoot( getGenerateDirectory().getPath()); } }
public void filterResource(String directory, String include, String targetPath, File outputDirectory) { Resource resource = new Resource(); resource.setDirectory(directory); resource.addInclude(include); resource.setFiltering(true); resource.setTargetPath(targetPath); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( Collections.singletonList(resource), outputDirectory, project, encoding, filters, defaultNonFilteredFileExtensions, session); System.out.println("mavenResourcesExecution: " + mavenResourcesExecution); mavenResourcesExecution.setInjectProjectBuildFilters(false); mavenResourcesExecution.setOverwrite(true); mavenResourcesExecution.setSupportMultiLineFiltering(true); try { mavenResourcesFiltering.filterResources(mavenResourcesExecution); } catch (MavenFilteringException e) { e.printStackTrace(); } }
/** * Augments Maven paths with generated resources. */ protected void setupMavenPaths() { if (getAddCompileSourceRoot()) { getProject().addCompileSourceRoot(getGenerateDirectory().getPath()); } if (getAddTestCompileSourceRoot()) { getProject().addTestCompileSourceRoot(getGenerateDirectory().getPath()); } if (getEpisode() && getEpisodeFile() != null) { final String episodeFilePath = getEpisodeFile().getAbsolutePath(); final String generatedDirectoryPath = getGenerateDirectory().getAbsolutePath(); if (episodeFilePath.startsWith(generatedDirectoryPath + File.separator)) { final String path = episodeFilePath.substring(generatedDirectoryPath.length() + 1); final Resource resource = new Resource(); resource.setDirectory(generatedDirectoryPath); resource.addInclude(path); if (getAddCompileSourceRoot()) { getProject().addResource(resource); } if (getAddTestCompileSourceRoot()) { getProject().addTestResource(resource); } } } }
/** * Augments Maven paths with generated resources. */ protected void setupMavenPaths() { if (getAddCompileSourceRoot()) { getProject().addCompileSourceRoot(getGenerateDirectory().getPath()); } if (getAddTestCompileSourceRoot()) { getProject().addTestCompileSourceRoot(getGenerateDirectory().getPath()); } if (getEpisode() && getEpisodeFile() != null) { final String episodeFilePath = getEpisodeFile().getAbsolutePath(); final String generatedDirectoryPath = getGenerateDirectory().getAbsolutePath(); if (episodeFilePath.startsWith(generatedDirectoryPath + File.separator)) { final String path = episodeFilePath.substring(generatedDirectoryPath.length() + 1); final Resource resource = new Resource(); resource.setDirectory(generatedDirectoryPath); resource.addInclude(path); if (getAddCompileSourceRoot()) { getProject().addResource(resource); } if (getAddTestCompileSourceRoot()) { getProject().addTestResource(resource); } } } }