2

I'm trying to publish obfuscated by ProGuard jar using sbt. I have this code so far, but it is not pushing obfuscated jar into the local ivy2 repo with sbt publish-local:

artifact in (Proguard, ProguardKeys.proguard) ~= {
  art => art.copy(`classifier` = Some("proguard"))
}
addArtifact(Artifact("myJar", "jar", "jar"), assembly in ProguardKeys.proguard)
publishArtifact in ProguardKeys.proguard := true 

Did you do such things before or have any ideas?

Thank you

nosmo
  • 108
  • 7

1 Answers1

2

Here is the trick:

// do not publish source, javadoc and default jar
publishArtifact in (Compile, packageBin) := false
publishArtifact in (Compile, packageDoc) := false
publishArtifact in (Compile, packageSrc) := false

// add the Proguard jar for publishing
addArtifact(artifact in (Compile, ProguardKeys.proguard), (ProguardKeys.proguard in Proguard) map { xs => xs.head })

With this config I disable publishing of the sources, javadoc and default jar, and add the jar generated by Proguard to be published. Now publish[Local] tasks publish only the pom and the Proguard jar.

martin-g
  • 17,243
  • 2
  • 23
  • 35