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

[MSHADE-303] Suppress module-info.class warning if the file if filtered #8

Merged
merged 2 commits into from
Oct 31, 2018
Merged
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
Next Next commit
Suppress module-info.class warning if the file if filtered
Maven always shows “Discovered module-info.class. Shading will break its strong encapsulation.” warning, even then the user has explicitly filtered those files out. The same with “META-INF/INDEX.LIST” file. 

This pull request fixes this by applying file filters BEFORE these built-in warning checkers.
  • Loading branch information
danilcha authored Oct 30, 2018
commit 7122bb7b965389c75d99d7d2abea308cf8bffc2d
25 changes: 14 additions & 11 deletions src/main/java/org/apache/maven/plugins/shade/DefaultShader.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ private void shadeJars( ShadeRequest shadeRequest, Set<String> resources, List<R
JarEntry entry = j.nextElement();

String name = entry.getName();

if ( entry.isDirectory() || isFiltered( jarFilters, name ) )
{
confinue;
}


if ( "META-INF/INDEX.LIST".equals( name ) )
{
Expand All @@ -185,18 +191,15 @@ private void shadeJars( ShadeRequest shadeRequest, Set<String> resources, List<R
continue;
}

if ( !entry.isDirectory() && !isFiltered( jarFilters, name ) )
try
{
try
{
shadeSingleJar( shadeRequest, resources, transformers, remapper, jos, duplicates, jar,
jarFile, entry, name );
}
catch ( Exception e )
{
throw new IOException( String.format( "Problem shading JAR %s entry %s: %s", jar, name, e ),
e );
}
shadeSingleJar( shadeRequest, resources, transformers, remapper, jos, duplicates, jar,
jarFile, entry, name );
}
catch ( Exception e )
{
throw new IOException( String.format( "Problem shading JAR %s entry %s: %s", jar, name, e ),
e );
}
}

Expand Down