Skip to content

jaybhai2/Scala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scala

Build

to clean and build the jar

mvn clean package
mvn clean package -Dtest=MyTestClass1

to clean, build jar and install jar in local .m2 repo

mvn clean install

to source from local repo in pom.xml

<repositories>
  <repositor>
    <id>mylocal-repo</id>
    <url>file://Users/jwei/.m2/repository/</url>

to to dependency tree (how pom source dependency)

mvn dependency:tree

to print out what scope are omitted

mvn dependency:tree -Dverbose

for scala REPL, run sbt console

with sbt console, sbt will aslo pull all class in the project directory to your REPL session. try to create a class in test.scala

class employee{
  val name = "jay";
  val age = 36;
}

then run sbt console,

scala> val emp = new employee
emp: employee = employee@3752b4f2
scala> println(emp.name)
jay
scala> println(emp.age)
36

in you wish to import some library in REPL, such as import org.apache.spark.SparkContext

exit REPL, and start sbt,

set libraryDependencies += "org.apache.spark" % "spark-core_2.10" % "2.0.2"  
show libraryDependencies
session save

or just put it in a build.sbt file then console will pull the dependency

1)sbt file structure


Image1

2) after 'sbt package' below two folder will be created


Image2

3) build.sbt format


Image2

4) to reload dependencies


Image2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages