如何从一些Scala源代码创建一个jar? [英] How can I create a jar from some Scala source code?
问题描述
如何从一些Scala源代码创建一个jar?我想在我的一个Clojure项目中使用一些代码。
How can I create a jar from some Scala source code? I want to use some of that code in a Clojure project of mine.
有一个比在这是什么问题?
谢谢,
Alex
Thanks, Alex
推荐答案
Scala在处理 .class
由其编译器生成的文件。只需使用 jar
命令和 c
操作标志。
Scala is in no way special when it comes to what you do with the .class
files produced by its compiler. Just use the jar
command with the c
action flag.
但是,当您运行使用Scala编译的程序 scala-library.jar
> .class 文件。并且小心地使用来自用于编译Scala源代码的同一个Scala Development Kit的 scala-library.jar
。至此,Scala生成的 .class
文件没有版本间的二进制兼容性。
However, you will need to have the scala-library.jar
file in the class-path when you run the program that uses the Scala-compiled .class
files. And be careful to use the scala-library.jar
for / from the same Scala Development Kit that you used to compile the Scala source. As of yet, there isn't inter-version binary compatibility for Scala-generated .class
files.
这篇关于如何从一些Scala源代码创建一个jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!