简体   繁体   中英

Compile scala files from a sbt plugin

I am developing a sbt plugin. In this plugin I generate some new scala sources packaged in a sbt project. Then I need to compile these new files programaticaly so that I could add the generated class in my classLoader.

I do not find any way to compile programaticaly sources from a given sbt project path (and eventually from a classLoader) in the sbt API, something as simple as the sbt command ( sbt compile ) line would be very convenient, something like:

XXX.compile(path/to/sbt/project)

Thanks

I suggest you have a look at sbt-boilerplate which is an sbt plugin that generates code, works well and is really simple.

Here's a link to the file that you probably want to take a look at

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