Giter Site home page Giter Site logo

wvengen / proguard-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW
592.0 29.0 151.0 567 KB

ProGuard Maven plugin that supports modularised ProGuard packages

Home Page: http://wvengen.github.io/proguard-maven-plugin/

License: Apache License 2.0

Shell 2.73% Java 96.15% Groovy 1.12%
java maven maven-plugin proguard minification obfuscation

proguard-maven-plugin's Introduction

ProGuard Maven Plugin

Run ProGuard as part of your Maven build. For usage, please read the generated Documentation.

Development happens at Github. This plugin is in a mature state, so major development changes are not expected. Pull requests are welcome.

This is the successor of the ProGuard Maven Plugin by pyx4me.

Build Status Maven Central

proguard-maven-plugin's People

Contributors

aasakawa avatar bartimmermans avatar brcolow avatar chuckame avatar cjgriscom avatar cmorty avatar dependabot[bot] avatar fibrefox avatar hisano avatar joeljons avatar john9x avatar jrodbx avatar kristofmoens avatar lasselindqvist avatar mahileeb avatar marcmil avatar mdaniel avatar mdeverdelhan avatar nkd avatar rladstaetter avatar sirchia avatar syquel avatar thargor avatar trask avatar velo avatar wvengen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

proguard-maven-plugin's Issues

<exclusions> should be part of <assembly>

In the plugin documentation there are examples stating that <exclusions> would be part of <assembly>. But in reality it seems <exclusions> are part of the higher level <configuration> element, which contradicts the documentation. To have <exclusions> parallel to <inclusions> seems a lot more intuitive too.
Thank you for considering my request.

Not able to provide/Change Obfuscated jar file name

Hello @wvengen

I am able to obfuscate my java application. But I am not able to change the output jar file name. It comming by default "filename-small.jar". I want to change the outjar file name. I tried by providing the name in -outjars but it is not reflected and it is still appended by -small.

Add support for Java 9 multi release jars

I've just updated a dependancy and it is now providing a multi release jar. This results in the following error when building:

Can't process class [META-INF/versions/9/com/teamdev/jxbrowser/chromium/internal/JavaVersion.class] (Unsupported class version number [53.0] (maximum 52.0, Java 1.8)))

Proguard doesn't yet support Java 9 but does have a workaround for this, which is to exclude the versions folder for library jars, eg:

--libraryjars somelib.jar(!META-INF/versions/**)

I've added support for this by blindly adding this exclusion for all library jars.

Does this sounds like an acceptable solution? If so I'll put a pull request together.

Support wildcard artefactId inclusion/exclusion

It would be great if you could include/exclude using a wildcard artefactId e.g.

<exclusion>
    <groupId>com.x</groupId>
    <artefactId>*</groupId>
</exclusion>

or take the fact that artefactId is null to mean include/exclude all

java.io.IOException: Cannot run program "...\java.exe" ...: CreateProcess error=206, The filename or extension is too long

Having complex configurations with multiple injars, options, libraryjars, makes the arguments list (https://github.com/wvengen/proguard-maven-plugin/blob/master/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java#L809) in the Java command. Use of includeDependency especially makes the command much longer

Some ways around this are

  1. Use Ant task with XML file configuration (https://www.guardsquare.com/en/products/proguard/manual/ant)
  2. Change this plugin to write the XML Maven config into a temporary config file and feed that to the Proguard command. For ease it might be better to make only some parts present in the temporary config file at first.
  3. User groups libaries and injars better and makes use of wildcards to decrease the length of the command line command.

I could implement option 2, but opinions on whether it makes sense are welcome.

Redacted output from a failed execution:
[2019-05-14T07:01:22.533Z] [INFO] --- proguard-maven-plugin:2.0.14:proguard (default) @ project-name ---
10:01:22 [INFO] execute ProGuard [-libraryjars, ... 27 000 characters of inputjars ...
multiple lines of options ...
[2019-05-14T07:01:22.869Z] [ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.14:proguard (default) on project project-name: Execution default of goal com.github.wvengen:proguard-maven-plugin:2.0.14:proguard failed: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_201\jre\bin\java.exe" (in directory "C:\Users\jenkins\project-name"): CreateProcess error=206, The filename or extension is too long -> [Help 1]

properties file can't be load

I can't load properties file when I use proguard. I found the folder hasn't modify time when I open this jar use RAR. I unzipped the jar , then zip the jar, this issue has been resolved.
image

Add CHANGELOG.md

Add CHANGELOG.md. Include as much history in this as possible.

runtime scope dep as libraryjar?

Hi,

Not new to proguard, but new to maven. I have a project that I'm trying to run proguard on, and it has some dependencies which are scoped as runtime (I believe this is because they are deployed separately? it's hdfs infra.)

The runtime scope dependencies are not being passed to proguard as libraryjars (nor in any other capacity). Proguard complains vociferously (as it should) and fails.

I'm surprised the maven plugin does not pass the runtime scope deps onto proguard? Is this a conscious design decision or an oversight? Is there any way to get it to?

Thanks!

How to instal this

Guys, it would be really helpful if you would tell us less experienced NetBeans users how to install this ProGuard Maven plugin into NetBeans (step-by-step would be great!)...thanx in advance (as this way it is quite useless or just for JAVA gurus, sorry))

not support windows 2012 x64 (but work on linux)

[DEBUG] proguardArtifact: C:\Users\myUser.m2\repository\net\sf\proguar
d\proguard-base\4.11\proguard-base-4.11.jar
Project base dir set to: D:\Temp\maven\test\test-server
[INFO] proguard jar: C:\Users\myUser.m2\repository\net\sf\proguard\pro
guard-base\4.11\proguard-base-4.11.jar
Execute:Java13CommandLauncher: Executing 'D:\jdk1.7.0_45\jre\bin\java.exe' with
arguments:
'-classpath'
'C:\Users\myUser.m2\repository\net\sf\proguard\proguard-base\4.11\prog
uard-base-4.11.jar'
'proguard.ProGuard'
'-injars'
''D:\Temp\maven\test\test-server\target\test-server-1.0_proguard_base.jar'
(!META-INF/maven/**)'
'-libraryjars'
''C:\Users\myUser.m2\repository\org\slf4j\slf4j-api\1.7.5\slf4j-api-1.
7.5.jar''
'-outjars'
''D:\Temp\maven\test\test-server\target\test-server-1.0.jar''
'-include'
''D:\Temp\maven\test\test-server\proguard.conf''
'-libraryjars'
''D:\jdk1.7.0_45\jre/lib/rt.jar''
'-libraryjars'
''D:\jdk1.7.0_45\jre/lib/jce.jar''
'-libraryjars'
''D:\jdk1.7.0_45\jre/lib/jsse.jar''
'-printmapping'
''D:\Temp\maven\test\test-server\target\proguard_map.txt''
'-printseeds'
''D:\Temp\maven\test\test-server\target\proguard_seeds.txt''
'-verbose'
'-keep public class * { public protected *; }'

The ' characters around the executable and arguments are
not part of the command.
[proguard] Error: Expecting class path separator ';' before 's' in argument num
ber 4
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] test-server ..................................... FAILURE [11.555s]
[INFO] test ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.954s
[INFO] Finished at: Mon Feb 03 23:20:15 CST 2014
[INFO] Final Memory: 10M/179M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.7:pr
oguard (proguard) on project test-server: Obfuscation failed (result=1) -> [He
lp 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal c
om.github.wvengen:proguard-maven-plugin:2.0.7:proguard (proguard) on project test
-server: Obfuscation failed (result=1)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:216)

Found an organisation

@wvengen What do you think about creating an organization. As far as I can see that is the only way of distributing power.

Bug: Assembly inclusions is not fully working

When we have multiple artifactId with the same artifactId, only the first found artifactId match.
This example will be collect only lib-one dependency :

<dependency>
   <groupId>my.group.id</groupId>
   <artifactId>lib-one</artifactId>
</dependency>
<dependency>
   <groupId>my.group.id</groupId>
   <artifactId>lib-two</artifactId>
</dependency>
...
<plugin>
  <artifactId>proguard-maven-plugin</artifactId>
  <assembly>
    <inclusions>
      <groupId>my.group.id</groupId>
      <artifactId>*</artifactId>
    </inclusions>
  </assembly>
</plugin>

Because of ProGuardMojo#getDependency :

private Artifact getDependency(Inclusion inc, MavenProject mavenProject) throws MojoExecutionException {

This method only returns the first matched artifact.

Fail to parse <![CDATA[<init>]]>

The following code is not parsed correctly:

<option>-keepclassmembers class * implements JsonSerializable {
    <![CDATA[<init>]]>;
}</option>

Log:

The ' characters around the executable and arguments are
not part of the command.
 [proguard] proguard.ParseException: Expecting class member name before ';' in argument number 132
 [proguard] 	at proguard.ConfigurationParser.checkJavaIdentifier(ConfigurationParser.java:1260)
 [proguard] 	at proguard.ConfigurationParser.parseMemberSpecificationArguments(ConfigurationParser.java:921)
 [proguard] 	at proguard.ConfigurationParser.parseClassSpecificationArguments(ConfigurationParser.java:748)
 [proguard] 	at proguard.ConfigurationParser.parseKeepClassSpecificationArguments(ConfigurationParser.java:534)
 [proguard] 	at proguard.ConfigurationParser.parse(ConfigurationParser.java:165)
 [proguard] 	at proguard.ProGuard.main(ProGuard.java:530)

It works fine with and though...

Reference

Add <inclusions/> for already assembled jar with <includeDependency>false</includeDependency>

There are some cases that <injar> configured with an already packaged with dependencies.

<includeDependency>false</includeDependency>
<injar>${project.build.finalName}-jar-with-dependencies.${project.packaging}</injar>
<outjar>${project.build.finalName}-proguard.${project.packaging}</outjar>

Now I need to tell proguard some provided scoped deps to process.

<inclusions>
  <inclusion>
    <groupId>some</groupId>
    <artifactId>some</artifactId> <!-- which is provided scope -->
  <inclusion>
</inclusions>

Currently I'm doing...

<includeDependency>true</includeDependency> <!-- by default -->
<injar>${project.build.finalName}-jar-with-dependencies.${project.packaging}</injar>
<outjar>${project.build.finalName}-proguard.${project.packaging}</outjar>
<exclusions>
    <!-- list all compile/runtime scoped dependencies -->
</exclusions>

Creating temporary library JAR directory fails if it already exists

Hi,

I'm using the plugin with the

<putLibraryJarsInTempDir>true</putLibraryJarsInTempDir>

option because of a large classpath. When running mvn proguard:proguard and when not having run mvn clean beforehand the temporary library directory ('tempLibraryjars') may already exist. If that's the case then the following call to mkdir() will return false and the proguard plugin will throw an exception:

https://github.com/wvengen/proguard-maven-plugin/blob/master/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java#L580

Can you please ignore the return value of mkdir() and instead check for the existence of the directory after the call to mkdir(), followed by cleaning it?

Thanks.

Error with proguard maven plugin version 2.0.4

have error with proguard maven plugin.

The ' characters around the executable and arguments are
not part of the command.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.959s
[INFO] Finished at: Tue Sep 17 10:54:54 CEST 2013
[INFO] Final Memory: 14M/167M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.4:proguard (default) on project vdg: Obfuscation failed (result=1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.4:proguard (default) on project vdg: Obfuscation failed (result=1)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Obfuscation failed (result=1)
at com.github.wvengen.maven.proguard.ProGuardMojo.proguardMain(ProGuardMojo.java:633)
at com.github.wvengen.maven.proguard.ProGuardMojo.execute(ProGuardMojo.java:486)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
[ERROR]
[ERROR]

springboot and proguard-maven-plugin

Hi!
I have developed a platform with springboot.I want to prevent others to decompile java source code.
How I make use of the plugin to confuse the java source code.
Please give me some suggestions about confusing source code.

Obfuscation failed

I'm getting the error "Obfuscation failed" when trying to do "mvn clean install" with Proguard 2.0.11.

My pom.xml looks like this:

com.github.wvengen proguard-maven-plugin 2.0.11

...

        <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>proguard</goal>
                    </goals>
                    <configuration>
                        <proguardVersion>5.0</proguardVersion>
                        <maxMemory>512m</maxMemory>
                        <injar>android-classes</injar>
                        <options>
                            <option>-allowaccessmodification</option>
                            <option>-keep public class * extends java.applet.Applet { *; }</option>
                        </options>
                        <libs>
                            <lib>${env.JAVA_HOME}/jre/lib/rt.jar</lib>
                            <lib>${env.JAVA_HOME}/jre/lib/jsse.jar</lib>
                        </libs>
                        <skip>false</skip>
                        <obfuscate>false</obfuscate>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </configuration>
                </execution>
            </executions>
        </plugin>

When I do MVN CLEAN INSTSALL I get this error:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.11:proguard (default) on project marlin-app-android: Obfuscation failed (result=1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

Thanks for any help.

tries to run proguard/Proguard with plugin jar, not proguard jar

While using your 2.0.4 version, plugin tries to execute proguard but with the plugin jar file itself.

We of course get a NoClassDefFoundError. :-)

I'll gladly correct this if you give me some pointers.

Thank you for stepping up and doing this fork.

log:

[INFO] --- proguard-maven-plugin:2.0.4:proguard (default) @ xxxxxxxxxxx ---
[INFO] execute ProGuard [-injars, 'xxxxxxxxxxxxxxxxxxxxx, -outjars, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', -include, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', -libraryjars, '/opt/sun-jdk-1.6.0.29/jre/lib/rt.jar', -libraryjars, '/opt/sun-jdk-1.6.0.29/jre/lib/jsse.jar', -libraryjars, '/opt/sun-jdk-1.6.0.29/jre/lib/resources.jar', -printmapping, 'xxxxxxxxxxxxxxxx', -printseeds, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx']
[INFO] proguard jar: /home/xxxx/.m2/repository/com/github/wvengen/proguard-maven-plugin/2.0.4/proguard-maven-plugin-2.0.4.jar
[proguard] Exception in thread "main" java.lang.NoClassDefFoundError: proguard/ProGuard
[proguard] Caused by: java.lang.ClassNotFoundException: proguard.ProGuard
[proguard] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[proguard] at java.security.AccessController.doPrivileged(Native Method)
[proguard] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[proguard] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[proguard] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[proguard] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[proguard] Could not find the main class: proguard.ProGuard. Program will exit.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Ability to filter -libraryjars entry

The plugin needs a way to filter a -libraryjars option, otherwise Proguard issues this warning:

[proguard] Warning: library class org.dom4j.swing.XMLTableDefinition extends or implements program class org.jaxen.VariableContext

Why? Because rt.jar (a library) depends on jaxen.jar which uses -injars. Why does it use -injars instead of -libraryjars with a filter? Because the latter isn't supported.

Release 2.0.7

Following "release often and release early" I suggest the following plan:

Comments?

Library filtering

No way to filter library inclusion. You can filter injars, but not libraryjars.

Assembly inclusions list generic

Hi.
I'm working with this plugin, but there is an embarrassing case in auto-completion (in my case, on eclipse).
In Assembly class, there is an inclusions list that is no typed.
This imply auto-completion not working because of raw type.

Anyway, in code, inclusions list is getted as an List<Inclusion> line 647-648 :


final List<Inclusion> inclusions = assembly.inclusions;

Can you just change List inclusions to List<Inclusion> inclusions in Assembly class ?

'injar' option not expanded on mvn proguard:proguard

During the package phase first we build an uber JAR with Maven Shade (output name ${project.build.finalName}-shaded.jar, replacing original file ${project.build.finalName}.jar).

If both Maven Shade and ProGuard-Maven are executed via mvn package everything is fine and the <injar>${project.build.finalName}-shaded.jar</injar> option is properly expanded.

Sometimes I have created my *-shaded.jar in a previous build without the obfuscation profile having been activated. In order to skip the slow shading action I just want to run mvn proguard:proguard. But in this case somehow Maven fails to expand the <injar>option, as can be seen in this log excerpt:

[DEBUG] Goal:          com.github.wvengen:proguard-maven-plugin:2.0.7:proguard (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <addMavenDescriptor default-value="false"/>
  <appendClassifier default-value="true"/>
  <attach default-value="false"/>
  <attachArtifactClassifier default-value="small"/>
  <attachArtifactType default-value="jar"/>
  <includeDependency default-value="true"/>
  <includeDependencyInjar default-value="false"/>
  <injar>${project.build.finalName}.jar</injar>
  <injarNotExistsSkip default-value="false"/>
  <mavenProject>${project}</mavenProject>
  <obfuscate default-value="true"/>
  <outputDirectory>${project.build.directory}</outputDirectory>
  <pluginArtifacts>${plugin.artifacts}</pluginArtifacts>
  <proguardInclude default-value="${basedir}/proguard.conf"/>
  <proguardMainClass default-value="proguard.ProGuard"/>
  <skip>${proguard.skip}</skip>
</configuration>

...

[ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.7:proguard (default-cli) on project my-artifact-jar: Can't find file c:\my-path\my-artifact-jar\target\my-artifact-jar-0.12-SNAPSHOT.jar -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.7:proguard (default-cli) on project my-artifact-jar: Can't find file c:\my-path\my-artifact-jar\target\my-artifact-jar-0.12-SNAPSHOT.jar
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoFailureException: Can't find file c:\my-path\my-artifact-jar\target\my-artifact-jar-0.12-SNAPSHOT.jar
    at com.github.wvengen.maven.proguard.ProGuardMojo.execute(ProGuardMojo.java:296)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more

Access denied when putLibraryJarsInTempDir = true

Hi, I have a multi modules project like this.

<project-root>
+- <module-1>
+- <module-2>
+- <module-3>  // proguard configured here

<module-1> and <module-2> are shaded together with <module-3> then only proceed to obfuscation.

It is working fine in version 2.0.14. When I update proguard-maven-plugin to version 2.1.0 without modifying configuration and run mvn package, it shows following error:

Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.1.0:proguard (default) on project my-project: Can't copy to temporary libraryJars directory: <project-root>\<module-1>\target\classes (Access is denied)

However, I can run it successfully if <putLibraryJarsInTempDir>true</putLibraryJarsInTempDir> is removed. Is there extra configuration needed in version 2.1.0 in order to put library jars in temporary directory?

NullPointerException at ProGuardMojo

I'm configuring a existing [maven] project to use ProGuard and I'm no being able to find the cause of this error:

Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.11:proguard (proguard) on project xxxx: Execution proguard of goal com.github.wvengen:proguard-maven-plugin:2.0.11:proguard failed. NullPointerException
...
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution proguard of goal com.github.wvengen:proguard-maven-plugin:2.0.11:proguard failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.lang.NullPointerException
    at com.github.wvengen.maven.proguard.ProGuardMojo.execute(ProGuardMojo.java:506)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)

I'm using:
proguard-maven-plugin:2.0.11
spring-boot-maven-plugin:1.2.8.RELEASE

I also tried to avoid this part of the code by adding:
includeDependency:false and includeDependencyInjar:false but the error still occurs

Does anyone has the same or related problem, or have any clue how to overcome this error?

Thanks in advance

New Release?

Hello @wvengen - would you be willing to do a new release? This would allow for me to use the new <proguardJar> feature and not have to use a SNAPSHOT version, which in turn would allow for me to add back the requirePluginVersions rule to maven-enforcer-plugin!

Let me know what you think, and thanks!

the generated jar could not be scanned by class loader

i tried to use this proguard plugin ,the generated jar is almost the same to the original jar after decompilation, however the classes in jar could not be scanned by class loader ,i use spring,the sourse code is PathMatchingResourcePatternResolver.java---getClassLoader().getResources("org/demo/config/").
the getResourses method return no jar囧,while when i replace it to the original jar it returned the jar, so strange........can anyone help me...

multiple module maven project

module A depends on module B in a maven project, if I execute mvn package in parent project, then all moudles will be compiled one by one. First in module B, one class named com.example.Test will be changed to com.a.A, it's ok. Then in A, com.example.Test remains com.example.Test because B is only a dependency of A. I expect that the class com.example.Test will be changed to com.a.A when module B is compiling. how can I do it?

Obfuscation failed (result=1)

Hi,

while executing obfuscate for my java code, it's getting fail.

As my log file is huge size, i am attaching only error info.

[proguard] Note: duplicate definition of library class [java.lang.OutOfMemoryError]
[proguard] Note: duplicate definition of library class [java.lang.VirtualMachineError]
[proguard] Note: duplicate definition of library class [java.lang.ArrayStoreException]
[proguard] Note: duplicate definition of library class [java.lang.ClassCastException]
[proguard] Note: duplicate definition of library class [java.lang.LinkageError]
[proguard] Note: duplicate definition of library class [java.lang.NoClassDefFoundError]
[proguard] Note: duplicate definition of library class [java.lang.ClassNotFoundException]
[proguard] Note: duplicate definition of library class [java.security.AccessControlContext]
[proguard] Note: duplicate definition of library class [java.security.ProtectionDomain]
[proguard] Note: duplicate definition of library class [java.lang.RuntimeException]
[proguard] Note: duplicate definition of library class [java.lang.Exception]
[proguard] Note: duplicate definition of library class [java.lang.ThreadDeath]
[proguard] Note: duplicate definition of library class [java.lang.Error]
[proguard] Note: duplicate definition of library class [java.lang.Throwable]
[proguard] Note: duplicate definition of library class [java.lang.System]
[proguard] Note: duplicate definition of library class [java.lang.ClassLoader]
[proguard] Note: duplicate definition of library class [java.lang.Cloneable]
[proguard] Note: duplicate definition of library class [java.lang.Class]
[proguard] Note: duplicate definition of library class [java.lang.Comparable]
[proguard] Note: duplicate definition of library class [java.io.Serializable]
[proguard] Note: duplicate definition of library class [java.lang.String]
[proguard] Note: duplicate definition of library class [java.lang.Object]
[proguard] Note: there were 15844 duplicate class definitions.
proguard
[proguard] Warning: there were 1632 classes in incorrectly named files.
[proguard] You should make sure all file names correspond to their class names.
[proguard] The directory hierarchies must correspond to the package hierarchies.
proguard
[proguard] If you don't mind the mentioned classes not being written out,
[proguard] you could try your luck using the '-ignorewarnings' option.
[proguard] java.io.IOException: Please correct the above warnings first.
[proguard] at proguard.InputReader.execute(InputReader.java:123)
[proguard] at proguard.ProGuard.readInput(ProGuard.java:218)
[proguard] at proguard.ProGuard.execute(ProGuard.java:82)
[proguard] at proguard.ProGuard.main(ProGuard.java:538)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.606s
[INFO] Finished at: Thu May 05 13:03:25 PDT 2016
[INFO] Final Memory: 38M/472M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.11:proguard (default) on project server-query-engine: Obfuscation failed (result=1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.11:proguard (default) on project server-query-engine: Obfuscation failed (result=1)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
Caused by: org.apache.maven.plugin.MojoExecutionException: Obfuscation failed (result=1)
at com.github.wvengen.maven.proguard.ProGuardMojo.proguardMain(ProGuardMojo.java:675)
at com.github.wvengen.maven.proguard.ProGuardMojo.execute(ProGuardMojo.java:527)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Thanks,
Sharat Z

License is unclear

The LICENSE.txt file contains a LGPL 2.1 while the headers of source files are Apache 2.0 compliant. Exactly under which license the plugin is released?

Find a new maintainer

As I'm not using this anymore in my work, I'm looking for another maintainer. If that sounds as something for you, please respond!

<attach>true</attach> ignores <outjar/>

Following configuration which doesn't have <attach/> works fine.

<injar>in.jar</injar>
<outjar>out.jar<outjar>

When I tried to add <attach>true</attach>,

<injar>in.jar</injar>
<outjar>out.jar<outjar>
<attach>true</attach>

<outjar/> ignored and in-small.jar is generated.

Upgrade to ProGuard 6

Message through mail:

Are you planning to roll the plugin over to use Proguard 6?
Currently the log tells me: [proguard] ProGuard, version 5.2.1

Search for proguardInclude on plugin classpath

Other Maven plugins like the maven-checkstyle-plugin offer the option to place the configuration file on the plugin’s classpath, thus making it easy to share the configuration among multiple projects (you can deploy your configuration to a Maven repo and it will get resolved from there). See https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-checker-config.html.

It would be great if the proguard-maven-plugin would also offer this feature, in particular as ProGuard configurations can be quite lengthy and in need of inline comments.

If there is interest in this feature, I’d be willing to prepare a pull request.

exclude .class file inside jar file

How can we exclude a .class file from the jar file.
The need of jar file is there but only the class should be excluded from it.

Windows 10
proguard version: 5.2.1
Java: 8

NullPointerException for wrong configuration

Hi!
I forgot to define some properties in my pom.xml, so the proguard config contained some unresolved variables. To be explicit:

-keepattributes ${proguard.keepattributes} My reward was the following NPE:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.wvengen:pr
oguard-maven-plugin:2.0.7:proguard (default) on project ammo-limited: Execution default of goal com.
github.wvengen:proguard-maven-plugin:2.0.7:proguard failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBu
ilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBu
ilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter
.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.github.wv
engen:proguard-maven-plugin:2.0.7:proguard failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.j
ava:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.NullPointerException
at com.github.wvengen.maven.proguard.ProGuardMojo.proguardMain(ProGuardMojo.java:640)
at com.github.wvengen.maven.proguard.ProGuardMojo.execute(ProGuardMojo.java:497)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.j
ava:101)
... 20 more

Looking for maintainer

Hi everyone, as you can see in the issues, my response is really slow. I'm sorry for the delay and extra work that has caused. It's due time to find one or more other people who'd be willing to maintain the project. That means mostly reviewing contributions, testing, keeping an eye on documentation and code quality; but most importantly, doing releases.

If anyone is interested, please respond here. I'm open to add people to this repository, or move the repository it to a new GH organisation if desired (don't forget to update doc generation config for the latter).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.