找出用于制作JAR的Scala版本 [英] Find out Scala Version Used to Make JAR

查看:212
本文介绍了找出用于制作JAR的Scala版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图找出用于编译 A.jar 的Scala版本。我有两个版本:一个来自我的ivy2 repo,另一个来自Maven。

I'm trying to figure out which Scala version was used to compile A.jar. I have two versions: one from my ivy2 repo, and the other from Maven.

运行 jar -xf A.jar ,我贪图 scala 版本,但一无所获:

After running jar -xf A.jar, I grepped for scala and version, but found nothing:

$grep -ri scala *
$grep -ri version *

因此,基于解压缩的* JAR ,如何确定使用哪个版本的Scala进行编译?

So, based on an unzipped* JAR, how can I determine which version of Scala was used to compile it?

* unzipped = run java xf< jar的名称>

*unzipped = run java xf <name of jar>

推荐答案

我所知道的唯一约定是将scala的版本放在jar的名称中,例如: scala-stm_2.9.3.jar
但这是一个约定; - )

The only convention I am aware of, is to put the version of scala in the name of the jar, for exemple : scala-stm_2.9.3.jar. But this is a convention ;-)

现在,如果名称不遵循该约定,从jar中获取任何class文件并运行if上的 javap 命令,cf:如何判断编译的.class文件的Scala版本是什么?

Now, if the name doesn't follow that convention, get any "class" file from the jar and run the javap command on if, cf: How can I tell what Scala version a .class file was compiled with?

这篇关于找出用于制作JAR的Scala版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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