Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions to obfuscate a JAR produced by sbt assembly #23

Closed
JithinThomas opened this issue Sep 6, 2017 · 1 comment
Closed

Instructions to obfuscate a JAR produced by sbt assembly #23

JithinThomas opened this issue Sep 6, 2017 · 1 comment

Comments

@JithinThomas
Copy link

JithinThomas commented Sep 6, 2017

Hi,

I'm trying to obfuscate a jar file produced by sbt assembly. I added the following changes to build.sbt (based on the answer provided in this SO post):

enablePlugins(SbtProguard)
ProguardKeys.inputs in Proguard := Seq(baseDirectory.value / "target" / s"scala-${scalaVersion.value.dropRight(2)}" / s"${name.value}-assembly-${version.value}.jar")
ProguardKeys.libraries in Proguard := Seq()
ProguardKeys.inputFilter in Proguard := { file => None }
ProguardKeys.merge in Proguard := false
(ProguardKeys.proguard in Proguard) <<= (ProguardKeys.proguard in Proguard).dependsOn(assembly)

However, when I run 'sbt assembly with these changes, I hit the following error:

/home/jithinpt/Documents/apps-infra/monitor/build.sbt:13: error: not found: value inputs
inputs in Proguard := Seq(baseDirectory.value / "target" / s"scala-${scalaVersion.value.dropRight(2)}" / s"${name.value}-assembly-${version.value}.jar")
^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q

Is there documentation that lists the steps to follow to obfuscate a jar (produced by sbt assembly) using sbt-proguard?

Thanks,
Jithin

@pvlugter
Copy link
Member

pvlugter commented Sep 7, 2017

The plugin keys were updated in #19. They're now namespaced appropriately with "proguard" prefix. And it's now an AutoPlugin, so keys will be auto-imported into your build.sbt. So you can replace ProguardKeys.inputs with proguardInputs and similarly for the other keys. See this file for the key names:

https://github.com/sbt/sbt-proguard/blob/master/src/main/scala/com/typesafe/sbt/ProguardKeys.scala

There's not currently documentation for running proguard on an assembly jar. This would be a useful contribution, if you'd like to write something up.

@pvlugter pvlugter closed this as completed Sep 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants