ProGuard : Obfuscated jar is not working but un-obfuscated jar is working
<p>I have one project which is part of another one. I am using <strong>maven</strong> build process to make project's jar. I used <strong>ProGuard</strong> to obfuscate it. I have some controllers which handles UI requests.</p>

<p><strong>Q. My problem is un-obfuscated jar is working. All controllers are getting hit, but obfuscated jar is not working (none controller gets hit). Whats the issue with obfuscation ?</strong></p>

<p>My Servlet.XML :</p>

<pre><code>&lt;context:component-scan base-package="myPackage.controllers" /&gt;
&lt;mvc:annotation-driven /&gt;
</code></pre>

<p>Sample controller code :</p>

<pre><code>package myPackage.controllers.information;

import myPackage.beans.InfoBean;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@RestController
@RequestMapping("/information")
public class InformationController {

    @RequestMapping(method = RequestMethod.GET)
    public return_bean getAllInformation() {
        //some logic
    }

    @RequestMapping(value = "/{infoId}", method = RequestMethod.PUT)
    public return_bean updateInformation(@PathVariable String InfoId, @RequestBody InfoBean info) {
        // some logic
    }
}
</code></pre>

<p>My POM.XML contents related to ProGuard :</p>

<pre><code>&lt;plugin&gt;
    &lt;groupId&gt;com.github.wvengen&lt;/groupId&gt;
    &lt;artifactId&gt;proguard-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.0.13&lt;/version&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;net.sf.proguard&lt;/groupId&gt;
            &lt;artifactId&gt;proguard-base&lt;/artifactId&gt;
            &lt;version&gt;5.2.1&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;goals&gt;
                &lt;goal&gt;proguard&lt;/goal&gt;
            &lt;/goals&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
    &lt;configuration&gt;
        &lt;maxMemory&gt;576m&lt;/maxMemory&gt;
        &lt;obfuscate&gt;true&lt;/obfuscate&gt;
        &lt;!-- File with proguard configuration --&gt;
        &lt;proguardInclude&gt;${basedir}/proguard.conf&lt;/proguardInclude&gt;
        &lt;libs&gt;
            &lt;lib&gt;${java7home}/jre/lib/rt.jar&lt;/lib&gt;
            &lt;lib&gt;${java7home}/jre/lib/jce.jar&lt;/lib&gt;
        &lt;/libs&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;
</code></pre>

<p>My ProGuard.conf file contents :</p>

<pre><code>-dontnot
-dontwarn
-dontshrink
-dontoptimize
-keep public class * { public protected *;}
-keep class myPackage.controllers.** { public protected *;}
-keepattributes SourceFile,Signature,LineNumberTable,Exceptions, *Annotation*
-keepparameternames
-printmapping '${logFilesPath}/${project.artifactId}.log'
</code></pre>

<p>I checked my obfuscated jar, all annotations are persisted.
Also in my information package I have some other classes which have package level access only. So those are getting obfuscated too. But all my classes which have RequestMappings are public and not getting obfuscated.</p>

<p><strong>My running environment :</strong></p>

<p>1) Java 1.7 for my project. But this jar is getting placed in project which is running on Java 1.8</p>

<p>2) ProGuard version : 5.2.1</p>

<p>3) Spring : 4.0.9</p>

<p>4) Jackson : 1.9.11</p>

<p>(<em>Note</em> : Un-ofuscated jar is working but obfuscated is not working in above environment)</p>