Adding an additional src directory or modifying the existing java source

1,543 views
Skip to first unread message

Dustin Whitney

unread,
Jun 20, 2011, 6:48:15 PM6/20/11
to simple-build-tool
Hello all,

I'm afraid I'm having a difficult time getting an non-standard
directory of Java source compiled in sbt 0.10. All of the code and
libs are in folders called research/code/src and research/code/lib,
respectively. I believe I have added the lib folder correctly with:

unmanagedBase <<= baseDirectory { base => base / "research" / "code" /
"lib" }

However, I'm having trouble adding the src folder. I've tried the
following which allows sbt to start up (i.e. build.sbt compiles), but
when I type "compile" I get the error printed after

unmanagedSources in Compile <+= (unmanagedSources in Compile) map
{ (src) =>(new File("research/code/src")) }

[error] source file '/Users/molecule/development/format-studio/sbt10/
research/code/src' could not be found

I think I need to use unmanagedSourceDirectories, but it's not obvious
to me how. I get the following when changing the names:

/Users/molecule/development/format-studio/sbt10/build.sbt:3: error:
type mismatch;
found : sbt.Project.Initialize[sbt.Task[java.io.File]]
required: sbt.Project.Initialize[sbt.Types.Id[java.io.File]]
unmanagedSourceDirectories in Compile <+= (unmanagedSourceDirectories
in Compile) map { (src) =>(new File("research/code/src")) }

Any help would be greatly appreciated.

Thanks,
Dustin

Frédérick Dubois

unread,
Jun 20, 2011, 9:33:38 PM6/20/11
to simple-b...@googlegroups.com
Hi Dustin,

Yes, I think what you need is unmanagedSourceDirectories. I have a
project that has java classes in non standard paths as well.

You can do something like this:

> show unmanaged-source-directories
[info] List(/tmp/test/src/main/scala, /tmp/test/src/main/java)
> set unmanagedSourceDirectories in Compile <+= baseDirectory( _ / "research" / "code" / "src" )
[info] Reapplying settings...
[info] Set current project to root (in build file:/tmp/test/)
> show unmanaged-source-directories
[info] List(/tmp/test/src/main/scala, /tmp/test/src/main/java,
/tmp/test/research/code/src)
> compile
[info] Updating...
[info] Done updating.
[success] Total time: 1 s, completed 20-Jun-2011 9:31:02 PM
>

Hope this helps,

-Fred

> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
>
>

Dustin Whitney

unread,
Jun 21, 2011, 5:51:04 AM6/21/11
to simple-build-tool
Fred,

Thank you! That solved my problem!

D
Reply all
Reply to author
Forward
0 new messages