Blog

scala で guava のバージョンを確認する

とりあえずこんな感じで。try-with-resources でやりたかったが、あんま短くかけなそうだった。

%spark
import java.util.Properties
import com.google.common.io.Resources

val resourceName = "META-INF/maven/com.google.guava/guava/pom.properties";
val properties = new Properties();
val inputStream = Resources.getResource(resourceName).openStream();
properties.load(inputStream);
println(properties.getProperty("version"))
inputStream.close()