简体   繁体   中英

Shortcut to launch java/scala without specific classpath

I am new to scala. Now I start to use the testing framework scalatest . But every time I run the test, I need to type scala -cp /path/to/jar/folder/scalatest_2.11-2.2.1.jar my_test.scala to include the scalatest package.

I want to type less. Here is what I think may work.

  • Put export CLASSPATH=/path/to/jar/folder/scalatest_2.11-2.2.1.jar;$CLASSPATH in .bashrc .
  • Put alias scalat="scala -cp /path/to/jar/folder/scalatest_2.11-2.2.1.jar" in .bashrc .

But I wanna know what is the common way to let scala/java know package without specific it in CLASSPATH in scala/java community?

通常的方法是使用SBT或Maven之类的构建系统(带有scala插件)​​来管理依赖项,类路径和构建周期。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM