use of org.apache.maven.model.Resource in project maven-plugins by apache.
the class MavenProjectResourcesStub method setupTestResources.
private void setupTestResources() {
Resource resource = new Resource();
// see MavenProjectBasicStub for details
// of getBasedir
// setup default test resources
resource.setDirectory(getBasedir().getPath() + "/src/test/resources");
resource.setFiltering(false);
resource.setTargetPath(null);
build.addTestResource(resource);
}
use of org.apache.maven.model.Resource in project maven-plugins by apache.
the class RarMojo method resourceHandling.
private void resourceHandling() throws MojoExecutionException {
Resource resource = new Resource();
resource.setDirectory(rarSourceDirectory.getAbsolutePath());
resource.setTargetPath(getBuildDir().getAbsolutePath());
resource.setFiltering(filterRarSourceDirectory);
List<Resource> resources = new ArrayList<Resource>();
resources.add(resource);
if (rarResources != null && !rarResources.isEmpty()) {
resources.addAll(rarResources);
}
MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(resources, getBuildDir(), project, encoding, filters, Collections.<String>emptyList(), session);
mavenResourcesExecution.setEscapeWindowsPaths(escapeWindowsPaths);
// never include project build filters in this call, since we've already accounted for the POM build filters
// above, in getCombinedFiltersList().
mavenResourcesExecution.setInjectProjectBuildFilters(false);
mavenResourcesExecution.setEscapeString(escapeString);
mavenResourcesExecution.setOverwrite(overwrite);
mavenResourcesExecution.setIncludeEmptyDirs(includeEmptyDirs);
mavenResourcesExecution.setSupportMultiLineFiltering(supportMultiLineFiltering);
mavenResourcesExecution.setDelimiters(delimiters, useDefaultDelimiters);
if (nonFilteredFileExtensions != null) {
mavenResourcesExecution.setNonFilteredFileExtensions(nonFilteredFileExtensions);
}
try {
mavenResourcesFiltering.filterResources(mavenResourcesExecution);
} catch (MavenFilteringException e) {
throw new MojoExecutionException("Error copying RAR resources", e);
}
}
use of org.apache.maven.model.Resource in project aries by apache.
the class ResourceInitializer method generateResourceEntry.
static String generateResourceEntry(MavenProject project) {
String buildDir = project.getBuild().getDirectory();
String generatedBaseDir = buildDir + "/generated-sources/blueprint";
Resource resource = new Resource();
resource.setDirectory(generatedBaseDir);
project.addResource(resource);
return generatedBaseDir;
}
use of org.apache.maven.model.Resource in project maven-plugins by apache.
the class MavenProjectResourcesStub method setupTestResources.
private void setupTestResources() {
Resource resource = new Resource();
// see MavenProjectBasicStub for details
// of getBasedir
// setup default test resources
resource.setDirectory(getBasedir().getPath() + "/src/test/resources");
resource.setFiltering(false);
resource.setTargetPath(null);
build.addTestResource(resource);
}
use of org.apache.maven.model.Resource in project maven-plugins by apache.
the class DefaultCheckstyleExecutor method addSourceDirectory.
protected void addSourceDirectory(CheckstyleCheckerListener sinkListener, Collection<File> sourceDirectories, Collection<File> testSourceDirectories, List<Resource> resources, CheckstyleExecutorRequest request) {
if (sourceDirectories != null) {
for (File sourceDirectory : sourceDirectories) {
if (sourceDirectory.exists()) {
sinkListener.addSourceDirectory(sourceDirectory);
}
}
}
if (request.isIncludeTestSourceDirectory() && (testSourceDirectories != null)) {
for (File testSourceDirectory : testSourceDirectories) {
if (testSourceDirectory.isDirectory()) {
sinkListener.addSourceDirectory(testSourceDirectory);
}
}
}
if (resources != null) {
for (Resource resource : resources) {
if (resource.getDirectory() != null) {
File resourcesDirectory = new File(resource.getDirectory());
if (resourcesDirectory.exists() && resourcesDirectory.isDirectory()) {
sinkListener.addSourceDirectory(resourcesDirectory);
getLogger().debug("Added '" + resourcesDirectory.getAbsolutePath() + "' as a source directory.");
}
}
}
}
}
Aggregations