Giter Site home page Giter Site logo

sbt-vaadin-plugin's Introduction

Warning! New Usage

0.0.2-SNAPSHOT change:

The new version (still snapshot) of the plugin has been build with sbt 0.11.1 and scala 2.9.1. Unfortunately sbt team has one more time change the way the plugins are packaged. Further more the siasia's xsbt-web-plugin has also changed, and requires some configuration change to make it work.

Here is the result of my two hours pain to make the new version plugin work:

in build.sbt:

  • jettyPort has been replaced by port
  • jetty configuration has been replaced by a more generic container

thus one should have now:

scalaVersion := "2.9.1"

seq((webSettings ++ vaadinSettings ++ Seq(
  port := 8081,
  vaadinWidgetSet := "scalaadin.gwt.CombinedWidgetset"
)) :_*)

and within the dependencies:

libraryDependencies ++= Seq(
  ...
  // jetty
  "org.eclipse.jetty" % "jetty-server" % "7.4.2.v20110526" % "container;provided",
  "org.eclipse.jetty" % "jetty-webapp" % "7.4.2.v20110526" % "container;provided",
  "org.eclipse.jetty" % "jetty-servlet" % "7.4.2.v20110526" % "container;provided",
  "javax.servlet" % "servlet-api" % "2.5" % "provided->default",
  ...
  //test
  "org.scala-tools.testing" %% "specs" % "1.6.9" % "test",
  ...
)

in project/plugins/build.sbt:

Similar to the %% that automatically bind the scala version, plugins are now tied to sbt version. For such plugins, the standard way is to now use the addSbtPlugin directive to add dependency on such plugins. xsbt-web-plugin use a non standard approach, so it requires a special management.

// remove this once plugins are working
retrieveManaged := true // and the dependencies will be copied to lib_managed as a build-local cache

resolvers ++= Seq(
  "Web plugin repo" at "http://siasia.github.com/maven2",
  "Arnauld" at "https://github.com/Arnauld/arnauld.github.com/raw/master/maven2"
)

addSbtPlugin("org.technbolts" % "sbt-vaadin-plugin" %  "0.0.2-SNAPSHOT")

libraryDependencies <++= (sbtVersion) { (sbt_ver) =>
    Seq("com.github.siasia" %% "xsbt-web-plugin" % (sbt_ver+"-0.2.10"))
}

Usage: 0.01-SNAPSHOT

Add the plugin to your project in project/plugins/build.sbt:

resolvers += "Arnauld" at "https://github.com/Arnauld/arnauld.github.com/raw/master/maven2",

e.g.

resolvers ++= Seq(
  "Web plugin repo" at "http://siasia.github.com/maven2",
  "Arnauld" at "https://github.com/Arnauld/arnauld.github.com/raw/master/maven2"
)

libraryDependencies <++= sbtVersion({ sbt_version:String => 
    Seq("com.github.siasia" %% "xsbt-web-plugin" % sbt_version,
        "org.technbolts" %% "sbt-vaadin-plugin" %  "0.0.1-SNAPSHOT")})

Add the Web and Vaadin settings to your project in build.sbt:

e.g.

seq((webSettings ++ vaadinSettings ++ Seq(
  jettyPort := 8081,
  vaadinWidgetSet := "scalaadin.gwt.CombinedWidgetset",
)) :_*)

This override the jetty port, and define the name of the widgetset

To generate the widgetset used by vaadin

sbt> vaadin-generate-widgetset
...

According to the settings, this will generate scalaadin/gwt/CombinedWidgetset.gwt.xml in src/main/resources

To compile the widgetset

sbt> vaadin-compile-widgetset
...

According to the settings, this will generate all GWT files in src/main/webapp/VAADIN/

Settings (all plugin versions)

  • gwtVersion by default 2.3.0
  • vaadinVersion by default 6.6.3
  • vaadinWidgetSet the name of the combined widget set that aggregates all widgetset found in the classpath to a single one.
  • vaadinClientWidgetSetDestination define where GWT compiles the widget, by default on src/main/webapp/VAADIN/widgetsets

Example:

seq((webSettings ++ vaadinSettings ++ Seq(
  jettyPort := 8081,
  vaadinWidgetSet := "scalaadin.gwt.CombinedWidgetset",
  vaadinVersion := "6.6.3"
)) :_*)

Vaadin

In order to use the widgetset, one must override the default widgetset used by Vaadin. In web.xml add the widgetset declaration

<init-param>
    <param-name>widgetset</param-name>
    <param-value>scalaadin.gwt.CombinedWidgetset</param-value>
</init-param>

e.g.

...
<servlet>
    <servlet-name>ScalaadinApplication</servlet-name>
    <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
    <init-param>
        <description>Vaadin application class to start</description>
        <param-name>application</param-name>
        <param-value>scalaadin.ScalaadinApplication</param-value>
    </init-param>
    <init-param>
        <param-name>widgetset</param-name>
        <param-value>scalaadin.gwt.CombinedWidgetset</param-value>
    </init-param>
</servlet>

Inspirations and related

sbt-vaadin-plugin's People

Contributors

arnauld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ashewring sbpmi

sbt-vaadin-plugin's Issues

sbt 0.11.2

Please do a release for 0.11.2 so all my plugins can happily work together again. :)

Error Compiling Widgetset

I followed the examples on the main page, but am getting the following:

vaadin-compile-widgetset
[info] Compiling scalaadin.gwt.CombinedWidgetset GWT module
[ERROR] Unable to find 'scalaadin/gwt/CombinedWidgetset.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

Is there another step missing from the examples or is this a bug?

sbt 0.11

Could you update this to work with sbt 0.11?

gwt/ecj classpath conflict

I ran into the stacktrace below when running the vaadin-compile-widgetset task, which I traced to this GWT issue:

http://code.google.com/p/google-web-toolkit/issues/detail?id=4479

The workaround is to put the GWT sdk first in the classpath:

dependencyClasspath in Vaadin <<= (dependencyClasspath in Vaadin) map { cp =>
  val (a, b) = cp partition { _.data.getAbsolutePath.contains("gwt") }
  (a ++ b)
} 

[ERROR] Unexpected
java.lang.NoSuchFieldError: warningThreshold
at com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:400)
at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.(JdtCompiler.java:228)
at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:689)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:215)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:406)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:299)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:325)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:507)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:492)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:405)
at com.google.gwt.dev.Compiler.run(Compiler.java:215)
at com.google.gwt.dev.Compiler.run(Compiler.java:187)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:159)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
at com.google.gwt.dev.Compiler.main(Compiler.java:166)

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.