scala - How to copy some files to the build target directory with SBT? -


how can copy source files (e.g. /src/main/html/*.html) build output directory (e.g. /target/scala-2.11/) sbt files end in target root , not in classes subdirectory (which happens if add source directory unmanagedresourcedirectories)?

you can define sbt task copying resources target directory:

lazy val copyres = taskkey[unit]("copyres")  lazy val root:project = project(    ... ) .settings(   ...   copyres <<= (basedirectory, target) map {     (base, trg) => new file(base, "src/html").listfiles().foreach(       file => files.copy(file.topath, new file(trg, file.name).topath)     )   } ) 

and use task in sbt:

sbt clean package copyres 

Comments