Clojure程序如何找到自己的MANIFEST.MF(假设它打包在JAR文件中)。Clojure程序读取自己的MANIFEST.MF
我想从我的“ - 主”的功能做到这一点,但我不能找到一个类下面的代码中使用:
(.getValue
(..
(java.util.jar.Manifest.
(.openStream
(java.net.URL.
(str
"jar:"
(..
(class **WHAT-GOES-HERE**)
getProtectionDomain
getCodeSource
getLocation)
"!/META-INF/MANIFEST.MF"))))
getMainAttributes)
"Build-number"))
感谢。
谢谢,这很有帮助。我做了一些重构,因为我对此很迷恋。这是我结束了: (DEFN得到功能定位 [符号] (..(类符号) getProtectionDomain getCodeSource 的getLocation)) (DEFN得到舱单的属性 [] (让[location(get-function-location get-manifest-attributes)] (when-not(nil?location) ( - >(str“jar:”location“!/META-INF/MANIFEST.MF)) (URL。) (.openStream) (Manifest。) (.getMainAttributes))))) – 2012-05-25 22:49:40
更正:将符号传递给函数不是正常工作。我最终做了重命名get-function-location来获取位置并将get-location传递给类。 – 2012-05-25 23:45:12