How does one change the source directory in the sb

2019-08-02 18:25发布

问题:

Per the docs, the default location is: src/main/resources.

My XSD's are in src/main/schema, so I need to change the sources setting.

So I have used the following:

sources in (xjc, Compile)  <+= sourceDirectory / "main" / "schema"

This results in:

overloaded method value in with alternatives:
[error]   (p: sbt.Reference,t: sbt.Scoped)sbt.ScopedTask[Seq[java.io.File]] <and>
[error]   (p: sbt.Reference,c: sbt.ConfigKey)sbt.ScopedTask[Seq[java.io.File]] <and>
[error]   (c: sbt.ConfigKey,t: sbt.Scoped)sbt.ScopedTask[Seq[java.io.File]]
[error]  cannot be applied to (sbt.TaskKey[Seq[java.io.File]], sbt.Configuration)
[error] Error occurred in an application involving default arguments.
[error]       sources in (xjc, Compile) <+= sourceDirectory / "main" / "schema"
[error]               ^
[error] one error found

回答1:

sources in (Compile, xjc) <<= sourceDirectory map (_ / "main" / "schema" ** "*.xsd" get)

docs have been updated.



标签: sbt xjc