Code Monkey home page Code Monkey logo

xsbt-web-plugin's People

Contributors

agjini avatar ambisoft avatar aolshevskiy avatar aryairani avatar bwkimmel avatar cdow avatar chrmang avatar colindean avatar davidharcombe avatar earldouglas avatar guersam avatar hjast avatar janheise avatar jannic avatar jcranky avatar joeytsaiexpedia avatar kiris avatar magnolia-k avatar mdedetrich avatar mtye avatar rladstaetter avatar scala-steward avatar tptodorov avatar xuwei-k avatar ymasory avatar zvozin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xsbt-web-plugin's Issues

Doc for error case in README.md

I would have put this into a wiki myself, but there does not seem to exist one?

This is a suggestion for more info for README.md:

If the beginning of jetty.xml goes:

The following error will occur, even with an otherwise correct configuration:

java.lang.IllegalArgumentException: Object is not of type class org.eclipse.jetty.server.Server
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:203)
at org.eclipse.jetty.plus.webapp.EnvConfiguration.configure(EnvConfiguration.java:118)
...

This works fine in the maven-jetty-plugin, but does not work with sbt. Googling for a solution yields hints in the direction of multiple versions of jetty on the classpath.

Replace "org.eclipse.jetty.server.Server" with "org.eclipse.jetty.webapp.WebAppContext" in the above tag, and this particular error might go away.

jetty-run failure if logging jars put in jetty conf

Most people using slf4j(or any other common logging for that matter) would want to put slf4j into "provided, jetty" and not in "compile" like the example shows. This results in a NoClassDefFoundError when running jetty-run, but then when we move slf4j-api.jar into "compile" and run package and deploy to our integration server, everything blows up as the is an api jar in jetty/lib(where we want it) and one in WEB-INF/lib where it should not be.

jetty-run should work and load all jars from the ivy jetty configuration, shouldn't it?

I am currently looking at the code and it looks like I will need to save a jar on the filesystem for now and modify the jettyClasspath somehow though I am still struggling with the syntax and I think I just put it in my build.sbt as a workaround until it all works, right? Any ideas on the syntax there(I am brand new to sbt).

container:reload Not working

Hi,

When I type container:reload in sbt it shows following error.

container:reload
[error] Expected whitespace character
[error] container:reload
[error]

Add JettyXMLConfiguration

Wanted to see what you think about this:

I've added support (but not yet cleanly) to use a standard jetty.xml file to configure jetty. It's kind of part of the way between the current DefaultJettyConfiguration and CustomJettyConfiguration. It uses jetty.xml to configure the server (including the logger) but uses the existing mechanism to create the webapp context (including the scanners).

It tries to make very few assumptions about what the jetty.xml is going to do, but it has to make some in order to stich in the webapp. It's got a lot in common with the jetty-runner jar.

It stands in the middle in terms of customization between the current default configuration and the custom configuration. It could actually be stitched in to the current default configuration fairly easily, retaining the existing behavior when no jetty.xml exists. If you were positive on that, that's what I'd do. If you're not really interested in it, I'll keep it as a separate config since that makes it easier to keep my fork in sync with the main fork.

There's another piece that I need and that is related, which is a setting for jetty.home (which logback-access is hardcoded to use). I think that's fairly straightfoward as jettyHome.

I'd propose having a jettyXml (jettyXML?) that defaults to jettyHome/etc/jetty.xml if jettyHome is set and the file exists.

None of this stuff impacts package-war because a war doesn't reference the server level stuff. However, it does impact the jar that xsbt-war-plugins creates when it embeds and I've got patches for that so that it picks up these settings and puts them in the right places.

Project dependencies not included as jars

Hi,

If I have a project named root, that depends on a subproject named subroot. Then when building root as a war file, i would like subproject to be included as a jar.
Is this possible, or do i just use the plugin wrong ?

replace JettyClasspaths type with something generic

Would you be okay with replacing the JettyClasspaths type with something generic, either a tuple or a Map?

I have tweaks to the embedding war plugin that use the web plugin settings to construct the jetty executable jar but it needs to treat the webapp and jetty classpaths differently. With the jettyClasspaths setting having a unique type, it's not possible to share it across the plugins.

I have a patch to use a tuple which is easy enough, but it is kinda gross and unclear what ._1 and ._2 are. Making it a Map[Symbol,PathFinder] would be easy enough and I suppose that's where my vote would go.

What do you think?

By the way, is this all just a workaround for the 9 parameter limit on tasks?

Basic build.sbt

Hi,

Can somebody provide basic build.sbt that works with sbt 0.10.1 and this plug-in? Whatever I do I cannot pass:

error: value github is not a member of package com seq(com.github.siasia.WebPlugin.webSettings :_*)

My build.sbt:


scalaVersion := "2.9.0.1"

resolvers ++= Seq(
  "Sonatype Nexus Releases" at "https://oss.sonatype.org/content/repositories/releases",
  "Web plugin repo" at "http://siasia.github.com/maven2",
  Resolver.url("Typesafe repository", new java.net.URL("http://typesafe.artifactoryonline.com/typesafe/ivy-releases/"))(Resolver.defaultIvyPatterns)
)

libraryDependencies ++= Seq(
  "org.scalatra" %% "scalatra" % "2.0.0.M4",
  "org.scalatra" %% "scalatra-scalatest" % "2.0.0.M4",
  "org.mortbay.jetty" % "jetty" % "6.1.22" % "test",
  "org.mortbay.jetty" % "servlet-api" % "2.5-20081211" % "provided",
  "org.apache.solr" % "solr-solrj" % "3.3.0" % "test",
  "org.apache.solr" % "solr-core" % "3.3.0" % "test",
  "commons-codec" % "commons-codec" % "1.5"
)

libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.1.1-"+v))

seq(com.github.siasia.WebPlugin.webSettings :_*)

Looks like xsbt-web-plugin dependency is not being resolved. http://siasia.github.com/maven2 cannot be browsed, might be related, or it simply might not show a list of files/folders, so I'm not sure.

Thank you!

Inaccurate README

This line:

seq(webSettings :_*)

Should read:

seq(com.github.siasia.WebPlugin.webSettings :_*)

src/test/resources not in classpath so logback.xml is not picked up

From slf4j documentation...

"Assuming the logback-test.xml file is placed under src/test/resources folder, Maven will ensure that it won't be included in the artifact produced. Thus, you can use a different configuration file, namely logback-test.xml during testing, and another file, namely, logback.xml, in production. The same principle applies by analogy for Ant. "

We don't place logback.xml in src/main/resources as that is put in the final jar and then overrides operations owned logback.xml file on the filesystem. It would be great if you could add src/test/resources to the classpath of jetty's startup so it would pick up that logback.xml file so developers can tweak that version without worrying about affecting production.

THANKS!
Dean

WAR content is not extensible

Hi there,

it seems that the files that are going to be on the war are not changeable, at least not in the same way I did before (on 0.1.x).

I need to do it because I minify js and css (among other things) at build time.

There used to be a temporaryWarPath and a prepare-webapp task, so I could execute

prepare-webapp
change the files on temporaryWarPath
package-war

On the current version, the war file is generated directly from src/main/webapp, so I'm not able to minify js/css without changing my source files.

maybe recreating temporaryWarPath and prepare-webapp would work for me.

Thanks

Publish release for SBT 0.11.1

Currently it fails with

sbt.ResolveException: unresolved dependency: com.github.siasia#xsbt-web-plugin_2.9.1;0.11.1-0.2.8: not found

also using the old version with the new SBT version fails with java.lang.NoClassDefFoundError: sbt/ScopedSetting

WebPlugin object doesn't reside in a package

Currently the WebPlugin does not reside in a package; this makes it super difficult to depend upon from another plugin. In my use case I need to package WAR files and then operate on that WAR file, but without the object being in a package I have no way to get at the settings or tasks that are a part of the war packaging without using something hacky like reflection etc.

If i've missed something, by all means let me know and i'll happily adopt a different path but based on conversations on the SBT mailing list this should be the right path to depend on WebPlugin as a library.

Cheers, Tim

lift_basic tests fail

With the new 'jetty' scope, sbt test will try and compile the tests and will fail because Jetty is missing.

Sbt can't find the plugin repository(perhaps an sbt issue)

Hi, I'm trying to create a project(actually just updating my web project to sbt 0.10) using xsbt-web-plugin so I decided to use a template:
https://github.com/JanxSpirit/scalatra-mongodb.g8
The project seems to be according to the plugin "Usage", however upon launching sbt I get the following error:

[warn] module not found: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1
[warn] ==== local: tried
[warn] /home/msena/.ivy2/local/com.github.siasia/xsbt-web-plugin_2.8.1/0.10.1/ivys/ivy.xml
[warn] -- artifact com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1!xsbt-web-plugin_2.8.1.jar:
[warn] /home/msena/.ivy2/local/com.github.siasia/xsbt-web-plugin_2.8.1/0.10.1/jars/xsbt-web-plugin_2.8.1.jar
[warn] ==== Web plugin repo: tried
[warn] http://siasia.github.com/maven2/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.pom
[warn] -- artifact com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1!xsbt-web-plugin_2.8.1.jar:
[warn] http://siasia.github.com/maven2/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.jar
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.pom
[warn] -- artifact com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1!xsbt-web-plugin_2.8.1.jar:
[warn] http://repo1.maven.org/maven2/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.jar
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn] http://scala-tools.org/repo-releases/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.pom
[warn] -- artifact com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1!xsbt-web-plugin_2.8.1.jar:
[warn] http://scala-tools.org/repo-releases/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info]
[warn] :: problems summary ::
[warn] :::: WARNINGS
[warn] module not found: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1
[warn] ==== local: tried
[warn] /home/msena/.ivy2/local/com.github.siasia/xsbt-web-plugin_2.8.1/0.10.1/ivys/ivy.xml
[warn] -- artifact com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1!xsbt-web-plugin_2.8.1.jar:
[warn] /home/msena/.ivy2/local/com.github.siasia/xsbt-web-plugin_2.8.1/0.10.1/jars/xsbt-web-plugin_2.8.1.jar
[warn] ==== Web plugin repo: tried
[warn] http://siasia.github.com/maven2/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.pom
[warn] -- artifact com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1!xsbt-web-plugin_2.8.1.jar:
[warn] http://siasia.github.com/maven2/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.jar
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.pom
[warn] -- artifact com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1!xsbt-web-plugin_2.8.1.jar:
[warn] http://repo1.maven.org/maven2/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.jar
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn] http://scala-tools.org/repo-releases/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.pom
[warn] -- artifact com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1!xsbt-web-plugin_2.8.1.jar:
[warn] http://scala-tools.org/repo-releases/com/github/siasia/xsbt-web-plugin_2.8.1/0.10.1/xsbt-web-plugin_2.8.1-0.10.1.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::

What could be causing this?

Configuring location of jetty-env.xml

I am trying to define a JNDI connection in src/main/webapp/WEB-INF/jetty-env.xml to be used in a Lift application with SBT 0.10.0.

The issue is, that the jetty-env.xml does not get loaded. In SBT 0.7.7, you could define the Jetty environment path in project/build/Project.scala as follows:

import sbt._

class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) {
ย ย override def jettyEnvXml = Some((sourcePath / "main" / "webapp" / "WEB-INF" / "jetty-env.xml").asFile)
...

Is there a similar possibility to set the path for the jetty-env.xml file to be loaded using the xsbt-web-plugin or is there another solution?

war name inconsistent with other artifacts

I notice that when I specify a non-standard project name in my build.sbt:

name := "Hello Lift"

sbt will normalize the artifact names:

> package-src
[info] Packaging ~/hellolift/target/scala-2.9.1/hello-lift_2.9.1-0.1-sources.jar
> package-doc
[info] Generating API documentation for main sources...
model contains 10 documentable templates
[info] API documentation generation successful.
[info] Packaging ~/hellolift/target/scala-2.9.1/hello-lift_2.9.1-0.1-javadoc.jar ...

But the web-plugin does not:

> package-war
[info] Compiling 3 Scala sources to ~/hellolift/target/scala-2.9.1/classes...
[info] Packaging ~/webapplications/hellolift/target/scala-2.9.1/Hello Lift_2.9.1-0.1.war ...

I think this can be fixed by changing line 60 of WarPlugin.scala:

artifact in packageWar <<= name(n => Artifact(n, "war", "war")),

to use the moduleName setting, consistent with Defaults.scala:

artifact <<= moduleName(n => Artifact(n)),

I will submit a pull request with this fix.

Long delay on jetty-run

Frequently, when I run jetty-run, I see:

> jetty-run
2011-07-09 14:35:47.264:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
[info] jetty-6.1.22
[info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet

And then, after a minute or more of delay,

[info] Started [email protected]:8080

Other times it starts listening right away. Any ideas what's going on? Using sbt 0.10 and Scala 2.9.0.1. My project/plugins/build.sbt:

resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"             
                                                                                
libraryDependencies <+= sbtVersion("com.github.siasia" %% "xsbt-web-plugin" % _)

sbt 0.10.1 support

Hi, any chance of seeing the web plugin updated for xsbt 0.10.1?

[error] {file:/home/yang/pod/sales/scala/project/plugins/}default-e472e6/*:update: sbt.ResolveException: unresolved dependency: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1: not found

Thanks!

RestContinuation within Jetty7

Hello, first thank you for this cool plugin and now with issue. I put together example and loaded into git https://github.com/Wlsek/test_continuation
I have problem and dont know where to put it, iam using lift framework, and within sbt 0.7.4 this use of RestContinuation worked, but when iam using newest xsbt and web plugin this doesnt work anymore. Am i doing something in wrong way ? Thank you for your time.

Classloader errors

Hi,

I'm porting my project from sbt 0.7 to 0.10 and hence using the new xsbt-web-plugin. I'm getting this exception, which I think means that there is some problem with the classloader setup of the new plugin.

ERROR my.MyServlet - org.fusesource.scalate.TemplateException: loader constraint violation: when resolving method "scala.tools.nsc.Settings
.(Lscala/Function1;)V" the class loader (instance of sbt/jetty/LazyJettyRun7$SbtWebAppLoader$1) of the current class, org/fusesource/scalate/support/ScalaCompiler, and the class loader (instance of java/net/URLClassLoader) for resolved class, scala/tools/nsc/Settings, have different Class objects for the type scala/Function1 used in the signature

org.fusesource.scalate.TemplateException: loader constraint violation: when resolving method "scala.tools.nsc.Settings.(Lscala/Function1;)V" the class loader (instance of sbt/jetty/LazyJettyRun7$SbtWebAppLoader$1) of the current class, org/fusesource/scalate/support/ScalaCompiler, and the class loader (instance of java/net/URLClassLoader) for resolved class, scala/tools/nsc/Settings, have different Class objects for the type scala/Function1 used in the signature
at org.fusesource.scalate.TemplateEngine.compileAndLoad(TemplateEngine.scala:775) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.TemplateEngine.compileAndLoadEntry(TemplateEngine.scala:637) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.TemplateEngine.liftedTree1$1(TemplateEngine.scala:368) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.TemplateEngine.load(TemplateEngine.scala:362) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.TemplateEngine.load(TemplateEngine.scala:420) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.TemplateEngine.layout(TemplateEngine.scala:521) ~[scalate-core-1.4.1.jar:1.4.1]
...
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "scala.tools.nsc.Settings.(Lscala/Function1;)V" the class loader (instance of sbt/jetty/LazyJettyRun7$SbtWebAppLoader$1) of the current class, org/fusesource/scalate/support/ScalaCompiler, and the class loader (instance of java/net/URLClassLoader) for resolved class, scala/tools/nsc/Settings, have different Class objects for the type scala/Function1 used in the signature
at org.fusesource.scalate.support.ScalaCompiler.generateSettings(ScalaCompiler.scala:118) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.support.ScalaCompiler.(ScalaCompiler.scala:49) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.support.ScalaCompiler$.create(ScalaCompiler.scala:39) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.TemplateEngine.compiler(TemplateEngine.scala:194) ~[scalate-core-1.4.1.jar:1.4.1]
at org.fusesource.scalate.TemplateEngine.compileAndLoad(TemplateEngine.scala:691) ~[scalate-core-1.4.1.jar:1.4.1]

The problem might be in scalate, but since it used to work with SBT 0.7 jetty-run and it works with tomcat, I would like to point the finger first at xsbt-web-plugin.

Heikki

Better extensibility (for sbt-gwt-plugin)

I'm trying to bring the gwt-plugin up to date with the new structure of the web-plugin, but I'm running into some issues.

One issue is that the prepareWebapp task went away, which the gwt-plugin made use of when running GWT devmode (which requires that the contents of src/main/webapp be copied into target). I looked into splitting packageWarTask back into prepareWarTask and packageWarTask, but the package task collects all of the files copied into the target directory and uses that info to prune any files that remain.

I was considering having prepareWarTask return a Set[File] enumerating the files it copied into target so that packageWarTask could make use of it, but that brings me to the second issue.

The gwt-plugin also needs to run the GWT compiler which generates javascript and other files which are placed into the target. This happens as a separate task (gwtCompileTask) which previously was added as a dependency to packageWarTask so that GWT compilation would take place before packaging. Now, it will be necessary to somehow communicate the generated files to packageWarTask so that it doesn't delete them.

I could perhaps have the GWT compiler task generate its output into target / "gwt" and the WarPlugin could have a mechanism for adding additional webappResources which would then get picked up during the copy phase.

Does this sound reasonable? I'll try to scrounge up the time to make these changes and submit a pull request, but if you think it's a crazy idea in the first place, let me know and we can come up with a different approach.

Error when using subprojects

If i have a project AWeb, and a project BWeb that have AWeb as a subproject. I get the following error.

java.lang.RuntimeException: AttributeKey ID collisions detected for 'prepare-webapp', 'jetty-conf-files', 'jetty-classpaths', 'jetty-port', 'jetty-scan-interval', 'jetty-context', 'watch-webapp-resources', 'temporary-war-path', 'jetty-scan-dirs', 'jetty-configuration', 'webapp-resources', 'webapp-unmanaged'
at scala.Predef$.error(Predef.scala:58)
at sbt.Index$.stringToKeyMap(Build.scala:143)
at sbt.Load$.structureIndex(Load.scala:120)
at sbt.Load$.apply(Load.scala:89)
at sbt.Load$.defaultLoad(Load.scala:41)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:349)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:346)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:61)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:61)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:63)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:63)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:71)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:71)
at sbt.State$$anon$1.process(State.scala:54)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:71)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:71)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:71)
at sbt.MainLoop$.run(Main.scala:62)
at sbt.xMain.run(Main.scala:32)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)

continuous execution

Feature Request:
what about a possibility to modify WatchState#lastCallbackCallTime ?
if you want to continuously generate files which are watchend the modification wil leed to an endless modification triggering.

i modified some code:

@tailrec def watch(sourcesFinder: PathFinder, pollDelayMillis: Int, state: WatchState)(terminationCondition: => Boolean): (Boolean, WatchState) = {
      import state._
      if (youngestFileTime == 0) {
         youngestFileTime = lastCallbackCallTime
       theLastCallbackTime=lastCallbackCallTime
      }

theLastCallbackTime = if (lastCallbackCallTime > youngestFileTime) lastCallbackCallTime else youngestFileTime

....

or is there a way to do that i did not see?

add "unmanagedClasspath" functionality

What do you think about adding the "normal" (in the overall sbt sense) managed/unmanaged/managed+unmanaged model to jetty's classpath? I have some things I need to get on there that aren't managed.

I can probably provide a patch/pull if you like the idea.

Option to include subprojects in WAR as JARs under WEB-INF/lib, rather than WEB-INF/classes

I have resources with the same name in different subprojects, so I can't include them in a flat classes directory. Instead, I want the subproject JARs inside the WAR.

This is currently only possible if I configure SBT with exportJars := true in all dependencies. I've found a blocking bugs with this, and in any case it's an intrusive change.

Currently, my workaround isn't so pretty: I've defined a new task exportedProductsUsingJars in each subproject, and configured jettyClasspaths to use this rather than exportedProducts.

object WebPluginExt {
  val webSettingsForceJars = Seq[Project.Setting[_]](
    internalDependencyClasspath in WebPlugin.jettyClasspaths <<= internalDependenciesJetty,
    dependencyClasspath in WebPlugin.jettyClasspaths <<= Classpaths.concat(
      internalDependencyClasspath in WebPlugin.jettyClasspaths,
      externalDependencyClasspath in Runtime
    ),
    // Classes from this project are directly packaged in the JAR; dependency projects are added as JARs.
    fullClasspath in WebPlugin.jettyClasspaths <<=
            Classpaths.concatDistinct(exportedProducts in Runtime, dependencyClasspath in WebPlugin.jettyClasspaths),
    WebPlugin.jettyClasspaths <<= (
            fullClasspath in WebPlugin.jettyClasspaths,
            managedClasspath in WebPlugin.jettyClasspaths) map WebPlugin.jettyClasspathsTask
  )

  private def internalDependenciesJetty =
    (thisProjectRef, thisProject, classpathConfiguration in Runtime, configuration in Runtime, Keys.settings) flatMap
            internalDependenciesJetty0

  private def internalDependenciesJetty0(projectRef: ProjectRef, project: ResolvedProject, conf: Configuration, self: Configuration, data: Settings[Scope]): Task[Classpath] =
    Classpaths.interDependencies(projectRef, project, conf, self, data, false, productsUsingJarsTask)

  private def productsUsingJarsTask(dep: ResolvedReference, conf: String, data: Settings[Scope]): Task[Classpath] =
    Classpaths.getClasspath(ExportJar.exportedProductsUsingJars, dep, conf, data)
}

/**
 * Adds a task to to export the classpath with the project code packaged in JARs,
 * rather than directories of classes, even when the SBT setting sbt.Keys.exportJars = false.
 */
object ExportJar {
  val exportedProductsUsingJars = TaskKey[Classpath]("exported-products-using-jars")

  lazy val exportJarSettings: Seq[Project.Setting[_]] = inConfig(Compile)(exportJarUnscopedSettings)

  private lazy val exportJarUnscopedSettings = Seq(
    exportedProductsUsingJars <<= (packageBin.task, compile) flatMap {
      (pkgTask, analysis) =>
        Seq(pkgTask).join map {
          _ map {
            f => Classpaths.analyzed(f, analysis)
          }
        }
    }
  )
}

Unresolved web-app dependency while using sbt 0.11

When I'm using sbt 0.11.0-RC0 I have a troubles with dependencies of new version xsbt-web-plugin.
Plugin itself is resolved without any problems.

An appeared exception below:
sbt.ResolveException: unresolved dependency: com.github.siasia.sbt#web-app;0.1.1

My project/plugins.sbt contains the next lines:
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"

addSbtPlugin("com.github.siasia" % "xsbt-web-plugin" % "0.1.1")

add this code to WebPlugin.scala please?

There used to be a "jetty" task that held there in 0.7. Can you add this....

val jetty: Command = Command.command("jetty")(withJettyInstance(_.startAndHold()))

and of course

commands ++= Seq(jettyRun, jettyStop, jettyReload, jetty)

and then startAndHold just runs the apply() and then reads from stdin.

The only thing I don't get is I have this all compiling but when I run it for some reason, I get NoSuchMethodError and it can't find the startAndHold method BUT when I compile and name it startAndHold2 instead, the compile correctly fails. It is like my changes don't make it into the jar at build time????

thanks!!!

Problem with "Unresolved dependencies" using sbt 0.11.0-RC1

Hello,

I'm working with sbt 0.11.0-RC1 and I've added some dependencies as xsbt-web-plugin and sbt-scalariform. I edit my project/build.sbt file like this:

      resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"

      resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"


      //Following means libraryDependencies += "com.github.siasia" %% "xsbt-web-plugin" % "0.1.1-<sbt version>""
      libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.1.1-"+v))

      libraryDependencies += "com.typesafe" %% "sbt-scalariform" % "0.1"

And the result is:

      unresolved dependency: com.github.siasia#xsbt-web-plugin_2.9.1;0.1.1-0.11.0-RC1: not found
      unresolved dependency: com.typesafe#sbt-scalariform_2.9.1;0.1: not found

Any ideas?
Thank you

Missing class

After i nuked my ivy cache, i keep getting this error. Tried to update everything, still no luck :o(

java.lang.NoClassDefFoundError: sbt/JettyConfiguration
at WebPlugin$.(WebPlugin.scala:25)
at WebPlugin$.(WebPlugin.scala)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sbt.ModuleUtilities$.getObject(ModuleUtilities.scala:10)
at sbt.Load$.loadPlugin(Load.scala:393)
at sbt.Load$$anonfun$loadPlugins$1.apply(Load.scala:390)
at sbt.Load$$anonfun$loadPlugins$1.apply(Load.scala:390)
at scala.collection.immutable.Stream.flatMap(Stream.scala:188)
at sbt.Load$.loadPlugins(Load.scala:390)
at sbt.Load$.loadPlugins(Load.scala:379)
at sbt.Load$.loadPluginDefinition(Load.scala:341)
at sbt.Load$.buildPlugins(Load.scala:335)
at sbt.Load$.plugins(Load.scala:332)
at sbt.Load$.loadUnit(Load.scala:318)
at sbt.Load$$anonfun$5.apply(Load.scala:172)
at sbt.Load$$anonfun$5.apply(Load.scala:172)
at sbt.BuildLoader.apply(BuildLoader.scala:17)
at sbt.Load$.loadAll(Load.scala:224)
at sbt.Load$.loadURI(Load.scala:181)
at sbt.Load$.load(Load.scala:177)
at sbt.Load$.load(Load.scala:175)
at sbt.Load$.apply(Load.scala:83)
at sbt.Load$.defaultLoad(Load.scala:41)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:371)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:368)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:61)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:61)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:63)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:63)
at sbt.Command$.process(Command.scala:91)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:72)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:72)
at sbt.State$$anon$1.process(State.scala:54)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:72)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:72)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:13)
at sbt.MainLoop$.next(Main.scala:72)
at sbt.MainLoop$.run(Main.scala:63)
at sbt.xMain.run(Main.scala:33)
at xsbt.boot.Launch$.run(Launch.scala:54)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)

Don't force Jetty as a dependency

We use this plugin mainly for producing war files and not for its ability to run jetty (we use tomcat instead). However if I do not add Jetty as a dependency then the plugin fails with:

"Jetty dependencies should be on container classpath"

I can appreciate that enabling jetty by default makes it easier to get something running quickly but I think there should be a way to disable this dependency check, for those of us who do not use Jetty.

"compile" triggers an immediate restart of a running container

with the 0.1 web-plugin we change source code and do a "prepare-webapp" which would trigger a compile and then cause a "jetty-reload" (we had scanInterval set to 0). i'm trying to figure out how to accomplish the same with the 0.2 version of the plugin.

first attempt:
using
scanDirectories in Compile := Null
we start jetty:

`````` container:startchange some source code and then compile:compile```
container is not restarted and an explicit
```container:reload /```
is necessary.

second attempt:
we drop the "scanDirectories" directive, start jetty:
container:start
change some source code and then compile:
compile
container is immediately restarted and then is restarted once more as soon as the compilation is finished.

how do we get the old prepare-webapp behavior?

maven repo does not exist?

While trying to do a clean checkout/sbt build I get:

update: sbt.ResolveException: unresolved dependency: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1: not found

In troubleshooting the instructions at https://github.com/siasia/xsbt-web-plugin indicating adding the following to plugins/build.sbt:

resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"

I notice that http://siasia.github.com/maven2 currently returns "Page does not exist!".

Is the repo down/moved?

sbt 0.11.0-RC1

com.github.siasia#xsbt-web-plugin_2.9.1;0.1.1-0.11.0-RC1: not found

Is it possible to get a build against sbt 0.11.0-RC1?

jetty-dependencies in the wrong configuration should give an error message

using library dependencies in the test configuration like
"org.eclipse.jetty" % "jetty-server" % "7.4.2.v20110526" % "test"
instead of in the jetty configuration like
"org.eclipse.jetty" % "jetty-server" % "7.4.2.v20110526" % "jetty"
makes jetty-run fail.

the server is not started, but there is no error message, either.
this is a bit irritating, even switching to debug logging does not
help to find out what's wrong.

run jetty in another configuration

Hi,

I tried to run jetty for my integration tests, but using another jettyPort (9090).

At first I tried to add a config-specific setting:

class MyBuild extends Build {
     lazy val root =
            Project("root", file("."))
                .configs( IntegrationTest )
               .settings(Defaults.itSettings : _*)
               .settings(inConfig(IntegrationTest)(WebPlugin.webSettings):_*)
               .settings(inConfig(IntegrationTest)(WebPlugin.jettyPort := 9090):_*)
} 

the only way I could use these settings (maybe because I'm a xsbt noob) was to modify this line on addJettyInstance method:

val result = Project.evaluateTask(jettyConfiguration in Compile, state)...

to

val result = Project.evaluateTask(jettyConfiguration in IntegrationTest, state)...

(I had to copy jettyRunAction and addJettyInstance source-codes to MyBuild)

Is there a way to change the default addJettyInstance to use the current config instead of a hard-coded Compile?

Or am I doing it wrong?

Thank you very much

Requiring src/main/webapp is unnecessary

Two scenarios:

(1) The app is using Servlet 3.0 Annotations only. Thus, src/main/webapp is not necessary at all.
(2) The app is a multi-module app and src/main/webapp is not in defined in some other dependent module (or it uses (1)) above.

I'm still trying to work out getting this plugin to work in a project using only servlet 3.0 annotations and a module structure:

root = AggregateProject(...)
core = Project()
module1 = Project(... dependsOn(core))
module2 = Project(... dependsOn(core))
module3 = Project(... dependsOn(module2))
war = Project(... dependsOn(module1, module3), settings = defaultSettings ++ webSettings))

However, I haven't been able to successfully get a war to package the dependent modules (and thus, I also assume that the jetty container isn't pulling in the other packages). I plan to file a separate issue when I determine the source of the problem.

JRebel and xsbt-web-plugin

How can I use JRebel along with the latest 0.2.7 version. Even if I were to apply the following settings

set scanDirectories := Nil
set scanInterval := 400000

The container would still do a full reload.

Could you please tell me how to enable JSP support on jetty-run command?

I added the following dependencies. But JSP support was not enabled.

val jetty = "org.eclipse.jetty" % "jetty-server" % "7.4.5.v20110725" % "jetty"
val jettyWeb = "org.eclipse.jetty" % "jetty-webapp" % "7.4.5.v20110725" % "jetty"
val jettyJsp = "org.eclipse.jetty" % "jetty-jsp-2.1" % "7.4.5.v20110725" % "jetty"

Do you know how to enable it?

SBT Web Plugin : Error getting ScopedKey(Scope(This,Select(ConfigKey(container)),This,This),full-classpath)

I get following error when running sbt with web-plugin.
[error] Error getting ScopedKey(Scope(This,Select(ConfigKey(container)),This,This),full-classpath)
[error] Use 'last' for the full log.

I'm using followings.
scala 2.9.0-1
sbt 0.11.0
xsbt-web-plugin 0.2.1

My Build file is as follows.

import sbt._
import com.github.siasia._
import WebPlugin._
import PluginKeys._
import Keys._
/**
 * Main sbt build file for the task-tracker project.
    *
 */
object TicketingCoreProject extends Build {
  val ticketingVersion = "1.0.0-SNAPSHOT"
  val Organization = "org.sansoft"
  val ScalaVersion = "2.9.0-1"

  val jodaTime = "joda-time" % "joda-time" % "1.6"
  val scalaTime = "org.scala-tools.time" % "time_2.8.0" % "0.2"
  val casbah = "com.mongodb.casbah" % "casbah_2.9.0-1" % "2.1.5.0"
  val Slf4jLog4jDep = "org.slf4j" % "slf4j-log4j12" % "1.6.1"
  val ScalaCheckDep = "org.scala-tools.testing" %% "scalacheck" % "1.9" % "test"
  val JUnitDep = "junit" % "junit" % "4.8.2" % "test"
  val scalaTesting = "org.scala-tools.testing" %% "specs" % "1.6.8" % "test"
  //val scctSbt = "ch.craven" %% "scct-plugin" % "0.2"
  val vaadin = "com.vaadin" % "vaadin" % "6.7.0"

  val jettyWebApp = "org.eclipse.jetty" % "jetty-webapp" % "7.3.0.v20110203" % "container"
  val jettyPlus = "org.eclipse.jetty" % "jetty-plus" % "7.3.0.v20110203" % "container"

  val repositories = Seq(
    ScalaToolsSnapshots,
    "typesafe releases" at "http://repo.typesafe.com/typesafe/releases",
    "typesafe snapshots" at "http://repo.typesafe.com/typesafe/snapshots",
    "scct-repo" at "http://mtkopone.github.com/scct/maven-repo")

  def publishToRepository = Some(Resolver.file("Local Maven Repository", Path.userHome / ".m2" / "repository" asFile))

  lazy val baseSettings = Defaults.defaultSettings ++ Seq(
    version := ticketingVersion,
    organization := Organization,
    scalaVersion := ScalaVersion,
    publishMavenStyle := true,
    publishTo := publishToRepository,
    resolvers ++= repositories,
    checksums := Nil
  )

  lazy val parent = Project("taskTrackerParent", file("."),
    settings = baseSettings ++ Seq(
      name := "task-tracker-parent"
    )) 

  lazy val core = Project("core", file("core"),
    settings = baseSettings ++ Seq(
      name := "core",
      libraryDependencies ++= Seq(
        jodaTime,
        scalaTime,
        scalaTesting,
        ScalaCheckDep,
        casbah,
        jodaTime,
    scalaTime)))  

  lazy val web = Project("web", file("web"),
    settings = baseSettings ++ webSettings ++ Seq(
      name := "web",
      libraryDependencies ++= Seq(
        jodaTime,
        scalaTime,
        scalaTesting,
        ScalaCheckDep,
        casbah,
    jodaTime,
    scalaTime,
        vaadin,
        jettyWebApp,
        jettyPlus))) dependsOn(core)

}

If I remove the configuration webSettings from the web project sbt project compiles fine. What have I done wrong in this???

Thanks in advance.

can now reproduce corruption issue

This may be more a core sbt issue though, but I can now reproduce

https://github.com/siasia/xsbt-web-plugin/issues/6

Basically, if you install the gen-idea plugin to generate idea files in your project, and then you install the same plugin in ~/.sbt/plugins/project/Build.scala as well, they collide and then this plugin stops working once you fix the collision and for some reason I then have to clear out .ivy2 completely.

There should really be another ticket opened probably on the fact that I can't have the same plugin in BOTH ~/.sbt and in the project since my project has the gen-idea plugin BUT I want to use it on every project so I also have it in .sbt/plugins/project but they collide so when I download xsbt-web-plugin, I move in my ~/.sbt folder and when I switch to my companies project, I have to move ~/.sbt to ~/.sbt.bak but if I forget to, it forces me to wipe out my .ivy2 cache for some reason as the xsbt-web-plugin stops working.

BIG NOTE: The gen-idea plugin does NOT need me to clear the .ivy2 cache. Somehow maybe these two plugins are interacting stepping on each other?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.