title: ProGuard Obufscation and Shadow Dependencies
body: <p>I am trying to use ProGuard to obfuscate my code, and then using the outputted code, use Shadow to add the needed dependencies into the JAR.</p>
  
  <p>Currently, I am simply getting a <code>-obf</code> JAR and a <code>-all</code> JAR. What I need is a <code>-all</code> JAR with obfuscated code.</p>
  
  <pre><code>import proguard.gradle.ProGuardTask
  
  apply plugin: 'com.github.johnrengelman.shadow'
  apply plugin: 'java'
  
  buildscript {
    repositories {
      mavenCentral()
      jcenter()
    }
  
    dependencies {
      classpath group: 'net.sf.proguard', name: 'proguard-gradle', version: '5.3.1'
      classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: '1.2.4'
    }
  }
  
  repositories {
    mavenCentral()
    jcenter()
  }
  
  jar {
    manifest { attributes("Main-Class": "com.skcraft.launcher.Launcher") }
  }
  
  dependencies {
    compile 'org.projectlombok:lombok:1.12.2'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.3.0'
    compile 'commons-lang:commons-lang:2.6'
    compile 'commons-io:commons-io:1.2'
    compile 'com.google.guava:guava:15.0'
    compile 'com.beust:jcommander:1.32'
    compile 'com.miglayout:miglayout:3.7.4'
    compile 'com.google.code.findbugs:jsr305:3.0.0'
    compile files ('libs/javax-crypto.jar')
  }
  
  processResources {
    filesMatching('**/*.properties') {
      filter {
        it.replace('${project.version}', project.version)
      }
    }
  }
  
  task obfuscate(type: proguard.gradle.ProGuardTask) {
    configuration '../proguard.txt'
  
    injars jar
    outjars "${buildDir}/libs/launcher-${version}-obf.jar"
  
    libraryjars files(configurations.compile.collect())
  }
  
  shadowJar {
    dependencies {
      exclude(dependency('org.projectlombok:lombok'))
    }
  }
  
  build.dependsOn(obfuscate)
  build.dependsOn(shadowJar)
  
  task wrapper(type: Wrapper) { gradleVersion = "3.1" }
  </code></pre>
  
  <p>Any ideas? One idea I did come up with using the <code>shadowJar</code> and then obfuscate that, however I need to configure my <code>proguard.txt</code> to only obfuscate my code. I attempted to do this below, but it still tried to obfuscate all the packages, throwing errors:</p>
  
  <pre><code># Include java runtime classes
  -libraryjars  &lt;java.home&gt;/lib/rt.jar
  
  # Output a source map file
  -printmapping proguard.map
  
  # Keep filenames and line numbers
  -keepattributes SourceFile, LineNumberTable
  
  # Disable certain proguard optimizations which remove stackframes (same as Android defaults)
  -optimizations !method/inlining/*
  
  -keep public class * {
      public protected *;
  }
  
  -keepclassmembernames class * {
      java.lang.Class class$(java.lang.String);
      java.lang.Class class$(java.lang.String, boolean);
  }
  
  -keepclasseswithmembernames class * {
      native &lt;methods&gt;;
  }
  
  -keepclassmembers enum * {
      public static **[] values();
      public static ** valueOf(java.lang.String);
  }
  
  -keep class !com.skcraft.** { *; }
  </code></pre>
  
  <p>Thanks in advance</p>