@@ -187,6 +187,13 @@ public class ProGuardMojo extends AbstractMojo {
187
187
*/
188
188
protected String inFilter ;
189
189
190
+ /**
191
+ * Apply ProGuard classpathentry Filters to all input lib jars. e.g. <code>!META-INF/**,!META-INF/versions/9/**.class</code>
192
+ *
193
+ * @parameter
194
+ */
195
+ protected String inLibsFilter ;
196
+
190
197
/**
191
198
* Specifies the names of the output jars. If attach=true the value ignored and name constructed base on classifier
192
199
* If empty input jar would be overdriven.
@@ -372,6 +379,18 @@ private String fileToString(File file) {
372
379
return fileNameToString (file .toString ());
373
380
}
374
381
382
+ private String libFileToStringWithInLibsFilter (File file ) {
383
+ return libFileToStringWithInLibsFilter (file .toString ());
384
+ }
385
+
386
+ private String libFileToStringWithInLibsFilter (String file ) {
387
+ StringBuilder filter = new StringBuilder (fileNameToString (file ));
388
+ if ((inLibsFilter != null )) {
389
+ filter .append ("(" ).append (inLibsFilter ).append (")" );
390
+ }
391
+ return filter .toString ();
392
+ }
393
+
375
394
private boolean useArtifactClassifier () {
376
395
return appendClassifier && ((attachArtifactClassifier != null ) && (attachArtifactClassifier .length () > 0 ));
377
396
}
@@ -516,7 +535,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
516
535
libraryJars .add (file );
517
536
} else {
518
537
args .add ("-libraryjars" );
519
- args .add (fileToString (file ));
538
+ args .add (libFileToStringWithInLibsFilter (file ));
520
539
}
521
540
}
522
541
}
@@ -570,7 +589,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
570
589
libraryJars .add (file );
571
590
} else {
572
591
args .add ("-libraryjars" );
573
- args .add (fileToString (file ));
592
+ args .add (libFileToStringWithInLibsFilter (file ));
574
593
}
575
594
}
576
595
}
@@ -605,7 +624,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
605
624
libraryJars .add (new File (lib ));
606
625
} else {
607
626
args .add ("-libraryjars" );
608
- args .add (fileNameToString (lib ));
627
+ args .add (libFileToStringWithInLibsFilter (lib ));
609
628
}
610
629
}
611
630
}
@@ -638,15 +657,15 @@ public void execute() throws MojoExecutionException, MojoFailureException {
638
657
File subDir = new File (tempLibraryjarsDir , String .valueOf (directoryIndex ));
639
658
FileUtils .copyDirectory (libraryJar , subDir );
640
659
args .add ("-libraryjars" );
641
- args .add (fileToString (subDir ));
660
+ args .add (libFileToStringWithInLibsFilter (subDir ));
642
661
}
643
662
} catch (IOException e ) {
644
663
throw new MojoFailureException ("Can't copy to temporary libraryJars directory" , e );
645
664
}
646
665
directoryIndex ++;
647
666
}
648
667
args .add ("-libraryjars" );
649
- args .add (fileToString (commonDir ));
668
+ args .add (libFileToStringWithInLibsFilter (commonDir ));
650
669
}
651
670
652
671
File mappingFile = new File (outputDirectory , mappingFileName );
0 commit comments