scalaを悩みつつ書いてsbtからproguardして実行可能jarを作成しました。 テストしてみるとorg.apache.commons.logging.impl.LogFactoryImplで "ClassNotFoundException"が発生しました。。 対処法の備忘録。 原因はproguardが必要なclassファイルを不要と判断して jarに含めてくれなかったことですね。 proguardを直に使っている場合は "-keep"を使って含めるclassなどを指定してやればいいのですが、 今はsbtからproguardを使っているのでやり方を調べました。 結局Project定義のscalaファイルに下記のように指定してやればいいようです。 MyProject.scala import sbt._ class MyProject(info: ProjectInfo) extend
scala 製アプリを1つの実行可能な jar ファイルにまとめたくなった。sbt にデフォルトでついている package アクションでは、依存するライブラリが jar には含まれないため不十分。今回は、sbt-proguard-plugin を利用することで対応した。ProGuard はJavaの組込み向けにアーカイブの軽量化、最適化、難読化する目的で作られたアプリケーションらしい。 例えば、以下のような src/main/scala/Hello.scala が実行可能な jar を生成したい。 object Hello { def main(argv: Array[String]): Unit = { println("Hello") } } 1.プラグインの組込み project/plugins/Plugins.scala を以下のように作成する。 import sbt._ cla
**注意** この記事は既に情報が古くなっていますので参考にするべきじゃないです。 未だに0.10以前のsbtを使っているなんて人ははやいとこ最新版に変えた方が幸せになれます。 sbt0.11以降対応のproguardプラグインはこちら GitHub - aolshevskiy/xsbt-proguard-plugin: A plugin for XSBT to facilitate the use of ProGuard to create single jars for XSBT-managed projects - githubのサイトはこちら。 GitHub - nuttycom/sbt-proguard-plugin: A plugin for SBT to facilitate the use of ProGuard to create single jars for SBT-
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く