Reputation: 599
How can I add a custom task to sbt build definition that consumes (uses classes, runs methods etc.) the project sources ? It seems it tries to find them before compiling even.
Upvotes: 5
Views: 1107
Reputation: 616
I need to know why you want to call the methods, since this changes the answer. If you want to do something ...
Want to use class/ methods which do something build related ( minfiy things, uploaded jar/wars to servers, etc..)
If it is build related, someone has probably dealt with a similar problem and there is probably a sbt plugin already, but if not, then let me know and I can explain creating sbt plugins.
Want to just call / test methods which don't have anything to do with the build cycle.
So for example, package script
object Script {
def foo = println("I am doing things non-build related")
}
in sbt now run
console
>> import script._
>> foo // prints out "I am doing things non-build related"
Upvotes: 6