softprops/coffeescripted-sbt — Issue #6: Files with the same name in different folders cause a duplicate mappings error during the compile:copy-resources phase
Author: vjpr
Created: 2011-11-12 11:22:54+00:00
State: open

It appears that when you compile two files with the same name but in different folders - the sbt `copy-resources` task produces the following error:

[error] {file:/Users/Vaughan/dev/x-unfiltered/}default-8111a8/compile:copy-resources: Duplicate mappings:
[error]	/Users/Vaughan/dev/x-unfiltered/target/scala-2.9.1/classes/RPCClient.js
[error] from
[error]	/Users/Vaughan/dev/x-unfiltered/target/scala-2.9.1/classes/extension/chrome/javascripts/rpc/RPCClient.js
[error]	/Users/Vaughan/dev/x-unfiltered/target/scala-2.9.1/classes/public/javascripts/rpc/RPCClient.js

By running sbt with debug level logging (`set logLevel in Global := Level.Debug`) I get the following debug output showing the problem:

[debug] Copy resource mappings:
[debug]	(/Users/Vaughan/dev/x-unfiltered/target/scala-2.9.1/classes/extension/chrome/javascripts/rpc/RPCClient.js,/Users/Vaughan/dev/x-unfiltered/target/scala-2.9.1/classes/RPCClient.js)
[debug]	(/Users/Vaughan/dev/x-unfiltered/target/scala-2.9.1/classes/public/javascripts/rpc/RPCClient.js,/Users/Vaughan/dev/x-unfiltered/target/scala-2.9.1/classes/RPCClient.js)
[debug]	(/Users/Vaughan/dev/x-unfiltered/src/main/resources/akka.conf.old,/Users/Vaughan/dev/x-unfiltered/target/scala-2.9.1/classes/akka.conf.old)

The problem appears to be that coffeescripted-sbt artifacts are being mapped to files in the `classes` directory - the root compilation directory. This also occurs for less-sbt artifacts too. This is an unnecessary step and I'm not sure why it is doing this.

I think it must be something to do with the `compile:managed-resource-directories` setting being used by the `compile:copy-resources` task.

Not sure whether this can be fixed or if its an sbt bug?