Unexpected behavior with ~;container:start; container:reload /

259 views
Skip to first unread message

fmpwizard

unread,
Sep 4, 2012, 3:41:24 PM9/4/12
to simple-b...@googlegroups.com
Hi,

At work we noticed some strange behavior in sbt, which I hope someone can help solve.

if our build.sbt file has this line:

unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }

and we run

~;container:start; container:reload /

any html page change we do, causes a jetty restart, which is not what we want.

But, if we change

unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }

for

unmanagedClasspath in Test <+= (baseDirectory) map { bd => Attributed.blank(bd / "src/main/webapp") }

then 

~;container:start; container:reload /

only reloads if you change a scala file.
The problem is, using 
unmanagedClasspath in Test <+= (baseDirectory) map { bd => Attributed.blank(bd / "src/main/webapp") }
brings up a bug in Intelli + the idea plugin, where your delete button and arrow keys stop working (I know, it sounds like it should not happen, but it does).

So, does anyone know why unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" } affects ~;container:start;container:reload  /    ? and how we could fix that?

Thanks

  Diego

Marko Elezović

unread,
Sep 4, 2012, 4:48:50 PM9/4/12
to simple-b...@googlegroups.com
Although I've setup the repository only to use our company Nexus proxy, and turned off other resolvers via the externalResolvers key in project/plugins.sbt, it doesn't seem to have effect.

  resolvers := Seq(
    "Element Nexus" at "http://maven.element.hr/nexus/content/groups/public/"
  , Resolver.url("Element Nexus (Ivy)",
      url("http://maven.element.hr/nexus/content/groups/public/"))(Resolver.ivyStylePatterns)
  )

  externalResolvers <<= resolvers map { rS =>
    Resolver.withDefaultResolvers(rS, mavenCentral = false)
  }

I already overrode the sbt.boot.properties, plugins and project resolvers.
It seems to work for the downloading the SBT and project dependencies, but for some reason the stubborn plugins keep downloading from the typesafe repository.

And http://typesafe.artifactoryonline.com/ seems to be down again...

What must one do in order to download plugins directly from the company Nexus proxy?

For the reduced example on Github I'm only using the sbteclipse plugin, but usually we are using approx. 5-10 different plugins per project cluster.
https://github.com/melezov/xsbt-reproductables/tree/master/stubborn-plugins

Thanx in advance,
Marko Elezović

Marko Elezović

unread,
Sep 4, 2012, 5:05:01 PM9/4/12
to simple-b...@googlegroups.com
Sorry about the thread intrusion :/

Marko Elezović

unread,
Sep 4, 2012, 5:22:52 PM9/4/12
to simple-build-tool
Double Post!

* * *
* * *

I've found a thread on Stack Overflow ...
http://stackoverflow.com/questions/9115405/sbt-0-11-using-a-corporate-maven-repository
... which states that from sbt 0.11.x one needs to use Artifactory for mirroring ivy-style repos.

Is this true - because our Nexus seems to be doing a nice job proxying so far:
http://maven.element.hr/nexus/content/groups/public/com.typesafe.sbteclipse/sbteclipse-plugin/scala_2.9.1/sbt_0.11.3/2.1.0/jars/

I'm unable to test this properly because:
a) if typesafe repo works it downloads from there instead of our corporate nexus
b) if typesafe doesn't work it fail-overs to our nexus where it also fails, trying to download from typesafe for the first time :/


* * *

Tim Nelson

unread,
Sep 7, 2012, 3:26:50 PM9/7/12
to simple-b...@googlegroups.com
Hi,

I found a solution to this. The continuous reload mechanism looks at the directories in global:watch-sources for changes. watch-resources consists of:

[info] compile:unmanaged-sources
[info] compile:unmanaged-resources
[info] test:unmanaged-sources
[info] test:unmanaged-resources

Since we added the webapp dir to test:unmanaged-resources it was also added to watch-sources.

So, all you need to do is filter out the webapp dir from watched-sources:

watchSources in Global ~= { ws => ws filter (!_.getAbsolutePath.endsWith("src/main/webapp")) }

Tim

Tim Nelson

unread,
Sep 7, 2012, 4:17:08 PM9/7/12
to simple-b...@googlegroups.com
Small correction, filter should be using contains and not endsWith:

watchSources ~= { ws => ws filter (!_.getAbsolutePath.contains("src/main/webapp")) }
Reply all
Reply to author
Forward
0 new messages