Leiningen具有建设工作uberjar问题 [英] Leiningen has problems building a working uberjar

查看:281
本文介绍了Leiningen具有建设工作uberjar问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在努力建设我们与Leiningen Clojure的项目。我们已经成功地通过执行以下操作创建一个uberjar:

preconditions:


  • project.clj文件列出了相关

  • :主要我-project.core 在project.clj

  • -main 功能core.clj文件

  • (:创一流:主真)在core.clj

步骤:


  • 跑<$​​ C $ C>雷音测试;没有失败已完成

  • 跑<$​​ C $ C>雷音DEPS ;成功完成

  • 从project.clj目录
  • :雨雷音uberjar

  • 这创建了两个jar文件:我的项目-1.0.0-快照standalone.jar,和我的项目-1.0.0-SNAPSHOT.jar

  • 跑<$​​ C $ C> Java的罐子BioClojure-1.0.0-快照standalone.jar ,导致此异常:


  

异常线程mainjava.lang.SecurityException异常:无效的签名文件的摘要清单主要属性。


我研究这个问题一直没有收获。 显然的,这是一个已知的问题没有很好的解决方案。我不明白的答案在那里。

什么是我们需要做的,让我们的工作uberjar?


  • 确定,我们的依赖是造成问题?

  • 从我们的项目中删除的依赖?

  • 编译该项目一些其他的方式?

  • 补丁leiningen?

  • 使用建议的命令:拉链* -standalone.jar -d META-INF / DUMMY.SF (我不知道这是什么一样)

  • 请与的东西:uberjar-排除在project.clj文件? (如果有,是什么?)


雷音和Java版本:

  $雷音版本
Leiningen 1.6.1关于Java 1.6.0_26的HotSpot的Java(TM)64位服务器VM


更新:在运行命令给出了建议:

  $解压-l BioClojure-1.0.0-快照standalone.jar | grep的-i -e\\ .SF
 49911 09年8月27日15:57 META-INF / RCSB-PDB.SF
     0 10年3月23日08:21 META-INF /行家/ net.sf.alxa /
     0 10年3月23日08:21 META-INF /行家/ net.sf.alxa / jlatexmath /
   929 10年3月23日08:20 META-INF /行家/ net.sf.alxa / jlatexmath / pom.xml的
   115 10年3月21日14:01 META-INF /行家/ net.sf.alxa / jlatexmath / pom.properties
175241 11年8月17日20:25 META-INF / SELFSIGN.SF
     0 09年9月21日六点45 META-INF /行家/ net.sf.opencsv /
     0 09年9月21日06:45 META-INF /行家/ net.sf.opencsv / opencsv /
  5510 09年9月21日06:44 META-INF /行家/ net.sf.opencsv / opencsv / pom.xml的
   106 09年9月21日06:45 META-INF /行家/ net.sf.opencsv / opencsv / pom.properties


解决方案

我在这个问题阅读评论的理解是,如果你添加以下到你的 project.clj <你的问题会消失/ code>

 :uberjar-排除[#foo.sf]

其中, foo.sf 是你想从罐子忽略特定.SF文件。您可以通过运行确定此:

 解压缩-l BioClojure-1.0.0-快照standalone.jar | grep的-i -e\\ .SF

建议的拉链命令删除罐子(这是ZIP格式)的特定文件。

We're trying to build our Clojure project with Leiningen. We've succeeded in creating an uberjar by doing the following:

preconditions:

  • project.clj file lists dependencies
  • :main my-project.core in project.clj
  • a core.clj file with a -main function
  • (:gen-class :main true) in core.clj

procedure:

  • ran lein test; completed with no failures
  • ran lein deps; completed successfully
  • from project.clj's directory: rain lein uberjar
  • This created two jar files: My-Project-1.0.0-SNAPSHOT-standalone.jar, and My-Project-1.0.0-SNAPSHOT.jar.
  • ran java -jar BioClojure-1.0.0-SNAPSHOT-standalone.jar, which resulted in this exception:

Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

My research into this problem has not been fruitful. Apparently, it's a known problem with no good solution. I do not understand the answers there.

What do we need to do to get our uberjar working?

  • determine which of our dependencies is causing the problem?
  • remove dependencies from our project?
  • compile the project some other way?
  • patch leiningen?
  • use the suggested command: zip *-standalone.jar -d META-INF/DUMMY.SF (I have no idea what this does)
  • do something with :uberjar-exclusions in the project.clj file? (if so, what?)

Lein and java versions:

$ lein version
Leiningen 1.6.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM


Update: running the command suggested gives:

$ unzip -l BioClojure-1.0.0-SNAPSHOT-standalone.jar | grep -i -e "\.sf"
 49911  08-27-09 15:57   META-INF/RCSB-PDB.SF
     0  03-23-10 08:21   META-INF/maven/net.sf.alxa/
     0  03-23-10 08:21   META-INF/maven/net.sf.alxa/jlatexmath/
   929  03-23-10 08:20   META-INF/maven/net.sf.alxa/jlatexmath/pom.xml
   115  03-21-10 14:01   META-INF/maven/net.sf.alxa/jlatexmath/pom.properties
175241  08-17-11 20:25   META-INF/SELFSIGN.SF
     0  09-21-09 06:45   META-INF/maven/net.sf.opencsv/
     0  09-21-09 06:45   META-INF/maven/net.sf.opencsv/opencsv/
  5510  09-21-09 06:44   META-INF/maven/net.sf.opencsv/opencsv/pom.xml
   106  09-21-09 06:45   META-INF/maven/net.sf.opencsv/opencsv/pom.properties

解决方案

My understanding from reading the comments in that issue is that your problem would go away if you add the following to your project.clj

:uberjar-exclusions [#"foo.sf"] 

where foo.sf is the particular .sf file you want to ignore from the jar. You can determine this by running:

unzip -l BioClojure-1.0.0-SNAPSHOT-standalone.jar | grep -i -e "\.sf"

The suggested zip command deletes the particular file from the jar (which is of the ZIP format).

这篇关于Leiningen具有建设工作uberjar问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆