Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected Exclude pattern behavior with Maven to avoid excluding all files #340

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
apply default excludes anytime a maven plugin is configured with sour…
…ceDirectory and not sourcePaths.
  • Loading branch information
ctrimble committed Apr 28, 2015
commit f3c8dedc3993ff4bef0f1d8abf5c2948bc7ac26e
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
*/
public class FilteringIT {
URL filteredSchemaUrl;
URL subSchemaUrl;

@Before
public void setUp() throws MalformedURLException {
filteredSchemaUrl = new File("./src/test/resources/schema/filtering").toURI().toURL();
subSchemaUrl = new File("./src/test/resources/schema/filtering/sub").toURI().toURL();
}

@Test
Expand All @@ -63,4 +65,13 @@ public void shouldIncludeNestedFilesWithFiltering() throws ClassNotFoundExceptio

resultsClassLoader.loadClass("com.example.sub.Sub");
}

@Test
public void shouldUseDefaultExcludesWithoutIncludesAndExcludes() throws ClassNotFoundException {
ClassLoader resultsClassLoader = generateAndCompile(subSchemaUrl, "com.example.sub",
config("includes", new String[] {}, "excludes", new String[] {}));

resultsClassLoader.loadClass("com.example.sub.Sub");
resultsClassLoader.loadClass("com.example.sub.sub2.Sub");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "a generic sub document",
"type": "object",
"properties": {
"prop": {
"type": "string"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "a generic sub document",
"type": "object",
"properties": {
"prop": {
"type": "string"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "a generic sub document",
"type": "object",
"properties": {
"prop": {
"type": "string"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,16 @@ public void execute() throws MojoExecutionException {
throw new MojoExecutionException("One of sourceDirectory or sourcePaths must be provided");
}

if (filteringEnabled()) {
if (filteringEnabled() || (sourceDirectory != null && sourcePaths == null) ) {

if (sourceDirectory == null) {
throw new MojoExecutionException("Source includes and excludes require the sourceDirectory property");
}

if( sourcePaths != null ) {
throw new MojoExecutionException("Source includes and excludes are incompatible with the sourcePaths property");
}

fileFilter = createFileFilter();
}

Expand Down