|
60 | 60 |
|
61 | 61 | public class ProGuardMojo extends AbstractMojo {
|
62 | 62 |
|
63 |
| - /** |
| 63 | + /** |
64 | 64 | * Set this to 'true' to bypass ProGuard processing entirely.
|
65 | 65 | *
|
66 | 66 | * @parameter property="proguard.skip"
|
@@ -123,7 +123,13 @@ public class ProGuardMojo extends AbstractMojo {
|
123 | 123 | * @parameter default-value="false"
|
124 | 124 | */
|
125 | 125 | private boolean putLibraryJarsInTempDir;
|
126 |
| - |
| 126 | + |
| 127 | + /** |
| 128 | + * Sets an exclude for all library jars, eg: (!META-INF/versions/**) |
| 129 | + * |
| 130 | + * @parameter default-value="" |
| 131 | + */ |
| 132 | + private String libraryJarExclusion; |
127 | 133 |
|
128 | 134 | /**
|
129 | 135 | * Specifies that project compile dependencies should be added as injar.
|
@@ -475,12 +481,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
475 | 481 | // This may not be CompileArtifacts, maven 2.0.6 bug
|
476 | 482 | File file = getClasspathElement(getDependency(inc, mavenProject), mavenProject);
|
477 | 483 | inPath.add(file.toString());
|
478 |
| - if(putLibraryJarsInTempDir){ |
479 |
| - libraryJars.add(file); |
480 |
| - } else { |
481 |
| - args.add("-libraryjars"); |
482 |
| - args.add(fileToString(file)); |
483 |
| - } |
| 484 | + addLibraryJar(args, libraryJars, file); |
484 | 485 | }
|
485 | 486 | }
|
486 | 487 | }
|
@@ -530,12 +531,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
530 | 531 | args.add(fileToString(file));
|
531 | 532 | } else {
|
532 | 533 | log.debug("--- ADD libraryjars:" + artifact.getArtifactId());
|
533 |
| - if (putLibraryJarsInTempDir) { |
534 |
| - libraryJars.add(file); |
535 |
| - } else { |
536 |
| - args.add("-libraryjars"); |
537 |
| - args.add(fileToString(file)); |
538 |
| - } |
| 534 | + addLibraryJar(args, libraryJars, file); |
539 | 535 | }
|
540 | 536 | }
|
541 | 537 | }
|
@@ -565,12 +561,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
565 | 561 |
|
566 | 562 | if (libs != null) {
|
567 | 563 | for (String lib : libs) {
|
568 |
| - if (putLibraryJarsInTempDir) { |
569 |
| - libraryJars.add(new File(lib)); |
570 |
| - } else { |
571 |
| - args.add("-libraryjars"); |
572 |
| - args.add(fileNameToString(lib)); |
573 |
| - } |
| 564 | + addLibraryJar(args, libraryJars, new File(lib)); |
574 | 565 | }
|
575 | 566 | }
|
576 | 567 |
|
@@ -691,6 +682,19 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
691 | 682 | }
|
692 | 683 | }
|
693 | 684 |
|
| 685 | + private void addLibraryJar(ArrayList<String> args, ArrayList<File> libraryJars, File file) |
| 686 | + { |
| 687 | + if (putLibraryJarsInTempDir) { |
| 688 | + libraryJars.add(file); |
| 689 | + } else { |
| 690 | + args.add("-libraryjars"); |
| 691 | + args.add(fileToString(file)); |
| 692 | + if (libraryJarExclusion != null) { |
| 693 | + args.add(libraryJarExclusion); |
| 694 | + } |
| 695 | + } |
| 696 | + } |
| 697 | + |
694 | 698 | private void attachTextFile(File theFile, String mainClassifier, String suffix) {
|
695 | 699 | final String classifier = (null == mainClassifier ? "" : mainClassifier+"-") + suffix;
|
696 | 700 | log.info("Attempting to attach "+suffix+" artifact");
|
|
0 commit comments