sbt proguard 插件不要将我的类放入 jar 中
这很有趣,但我的项目配置做了一切来生成可执行 jar,除了将我的项目类添加到最终 jar:
import sbt._
class ProjectDescriptor(info: ProjectInfo) extends DefaultProject(info) with ProguardProject{
override def mainClass = Some("org.myproject.MyClass")
override def proguardOptions = List(
"-keepclasseswithmembers public class * { public static void main(java.lang.String[]); }",
"-dontoptimize",
"-dontobfuscate",
proguardKeepLimitedSerializability,
proguardKeepAllScala,
"-keep interface scala.ScalaObject"
)
val scalaLibraryPath = "<...>/project/boot/scala-2.8.0/lib"
override def proguardInJars = super.proguardInJars +++ Path.fromFile(scalaLibraryPath)
}
如何修复它?
That is funny but my project configuration does everything to generate executable jar except adding my project classes to final jar:
import sbt._
class ProjectDescriptor(info: ProjectInfo) extends DefaultProject(info) with ProguardProject{
override def mainClass = Some("org.myproject.MyClass")
override def proguardOptions = List(
"-keepclasseswithmembers public class * { public static void main(java.lang.String[]); }",
"-dontoptimize",
"-dontobfuscate",
proguardKeepLimitedSerializability,
proguardKeepAllScala,
"-keep interface scala.ScalaObject"
)
val scalaLibraryPath = "<...>/project/boot/scala-2.8.0/lib"
override def proguardInJars = super.proguardInJars +++ Path.fromFile(scalaLibraryPath)
}
How to fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有使用 ProGuard,而是使用 OneJar 插件通过 sbt-onejar 创建可执行 jar。它要简单得多,因为您不必搞乱像 ProGuard 这样的一堆选项。
Instead of ProGuard, I use the OneJar plugin to create executable jars with sbt-onejar. It's a lot simpler since you don't have to mess with a bunch of options like ProGuard.
我不确定 ProguardProject 提供了什么。但我认为你可以尝试
这对我有用。
I am not sure what
ProguardProject
provides. But I think you can tryThis works for me.