Can not reflect changes using gwt-maven-plugin superdev - gwt

Follow steps in this post,
I use gwt-maven-plugin 2.6.0, when I run mvn gwt:run-codeserver it compiled successfully:
[INFO] binding: user.agent=safari
[INFO] Compiling module com.example.myModule
[INFO] Validating units:
[INFO] Ignored 3 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO] ...
[INFO] Compiling 1 permutation
[INFO] Compiling permutation 0...
[INFO] Source Maps Enabled
[INFO] Compile of permutations succeeded
[INFO] Linking into C:\Users\admin\AppData\Local\Temp\gwt-codeserver-5664784549647002986.tmp\com.example.myModule\compile-4\war\myModule;
Writing extras to C:\Users\admin\AppData\Local\Temp\gwt-codeserver-5664784549647002986.tmp\com.example.myModule\compile-4\extras\myModule
[INFO] Link succeeded
[INFO] Compilation succeeded -- 3.401s
[INFO] Compile completed in 3496 ms
Then I started the dev server using mvn install gwt:run, made changes on my source file and click the Dev Mode On bookmark. After compiling the changes cannot reflect to UI: the UI always show old values.
Any ideas on this problem?

There's a bug in gwt-maven-plugin up to (including) 2.6.0; you have to run mvn process-classes gwt:run-codeserver instead of just mvn gwt:run-codeserver. This is fixed in 2.6.1.
Also, if you change anything in src/main/resources, you'll have to run mvn process-resources to make your changes available to Super Dev Mode (this is because you might use resource filtering, so Super Dev Mode doesn't directly look at src/main/resources).
Similarly, if you use plugins that generate resources or Java sources, you'll have to run them manually (e.g. mvn generate-sources or mvn generate-resources; or just use the same mvn process-resources as above, which will do everything at once). This will be necessary for example if you use gwt:generateAsync and change your GWT-RPC interface (note that you'll also have to redeploy your server-side code).
Note: I just updated my answer in the linked post for GWT 2.6.0, and added a note about GWT-RPC, and the gwt-maven-plugin bug.

Related

Play activator downloading resources on each run

I am trying to learn Scala by implementing a simple API in Play framework. I am creating an app by command
activator new app play-scala
Then in app folder I'm doing activator run then it starts downloading tons of data from internet. I tried offline:=true in build.sbt and using the offline version activator instead of minimal one but with no success.
[info] Loading project definition from /home/amit/Codes/scala/app/project
[info] Updating {file:/home/amit/Codes/scala/app/project/}app-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to app (in build file:/home/amit/Codes/scala/app/)
[info] Updating {file:/home/amit/Codes/scala/app/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://repo1.maven.org/maven2/com/typesafe/play/play-omnidoc_2.11/2.5.3/play-omnidoc_2.11-2.5.3.jar ...
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbtrc/client-2-11/0.3.1/jars/client-2-11.jar ...
[info] [SUCCESSFUL ] com.typesafe.sbtrc#client-2-11;0.3.1!client-2-11.jar (102499ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.11.5/scala-reflect-2.11.5.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scala-reflect;2.11.5!scala-reflect.jar (136599ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/serialization_2.11/0.1.0/jars/serialization_2.11.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#serialization_2.11;0.1.0!serialization_2.11.jar (12655ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/io_2.11/0.13.8-M3/jars/io_2.11.jar ...
I have a very slow connection and I am stuck with it. I don't know something that easy in python-flask can be so difficult in scala-play or am I missing something?
By issuing activator new app play-scala activator only creates a copy of template (usually located at ~/.activator//templates). Of course template itself has to be downloaded first but it is normally tiny.
Effect what you are seeing is that when you run activator run the SBT first time resolves dependencies of your application created according to template. Two situations can happen:
you have already a lot of dependencies in your ~/.ivy2 directory because e.g. you have created project according to the template before or project with similar dependencies via SBT (not strictly with activator). Then the dependencies will be resolved and not downloaded.
you have no dependencies at all in ~/.ivy2 or your template uses such different ones that they have to be downloaded.
Your milage may vary, but important point is that your dependencies are related to your template not activator itself. Another important thing to note is that they have to be definitely downloaded at least once to be used (this is strongly dependent from state of your ~/.ivy2 directory).
I guess that you are trying activator for the first time, or at least play-scala template, thus you have to wait and definitely use better internet connection :)

superdev mode not loading module

Hello I'm upgrading my gwt from 2.4.0 to 2.7.0 with gxt 2.3.1a. Everything was looking alright ultil I try to debug the application. I start the debug using superdev mode without any problems aparently. Here is the end of my debug start.
"
[INFO] Unification traversed 108163 fields and methods and 8186 types. 8146 are considered part of the current module and 8146 had all of their fields and methods traversed.
[INFO] Compiling 1 permutation
[INFO] Compiling permutation 0...
[INFO] Linking per-type JS with 8130 new types.
[INFO] prelink JS size = 26317582
[INFO] prelink sourcemap = 26317582 bytes and 534648 lines
[INFO] postlink JS size = 26027857
[INFO] postlink sourcemap = 26027857 bytes and 528723 lines
[INFO] Source Maps Enabled
[INFO] Compile of permutations succeeded
[INFO] Compilation succeeded -- 128,510s
[INFO] Linking into C:\Users\ALEXAN~1.RIS\AppData\Local\Temp\gwt-codeserver-3435183735990420589.tmp\br.com.webb.ria.Application\compile-2\war\br.com.webb.ria.Application; Writing extras to C:\Users\ALEXAN~1.RIS\AppData\Local\Temp\gwt-codeserver-3435183735990420589.tmp\br.com.webb.ria.Application\compile-2\extras\br.com.webb.ria.Application
[INFO] Link succeeded
[INFO] Linking succeeded -- 11,742s
[INFO] 147,211s total -- Compile completed
"
After I start the remote debug I get the normal gray window of gwt debug plugin. Everything is processed without any errors. When I copy the generated link on my browser I get the following message.
"Compiling br.com.webb.ria.Application" My gwt module.
The problem is that after the message vanishes I get nothing but the plain html. The module is not loaded on screen and I can't see my application.
I've tried using the "Dev Mode On" button from my bookmark, nothing happens. I tried to stop using "Dev Mode Off" and then clicking on "Dev Mode On" again, nothing happens.
I also tried enabling https support and <set-property name="user.agent" value="safari" />. Nothing seems to help. Any ideas?
Unlike convencional debug mode, superdev mode requires a full compilation before debuging to work. If you are using maven and face the same problem, perform a mvn clean package before trying to debug.

Cannot see jacoco task when executing sbt tasks command (-v is tried as well)

I was trying to use jacoco to integrate test report to my sbt project. https://github.com/sbt/jacoco4sbt
I added jacoco.settings into build.sbt
I also added addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.6") into plugins.sbt
When I run sbt jacoco:check, it is working fine. However, when I try to look at how many tasks for jacoco, sbt tasks doesn't show anything related to jacoco.
I have to go to source code to look at it.
https://github.com/sbt/jacoco4sbt/blob/master/src/main/scala/de/johoop/jacoco4sbt/Keys.scala
May I know why jacoco is not shown for sbt tasks command and what is preferable way to look at all the available tasks for the plugins
Edit:
I suspect that the statement lazy val Config = config("jacoco") extend(Test) hide means jacoco extends Test task, so it wont show it in the sbt tasks, but I am not sure.
By running
> tasks -v
Edit: If that doesn't work consider adding more "v"s, such as tasks -vvv, or even tasks -V to see all the tasks.
I see, for instance, cover:
This is a list of tasks defined for the current project.
It does not list the scopes the tasks are defined in; use the 'inspect' command for that.
Tasks produce values. Use the 'show' command to run the task and print the resulting value.
check Executes the tests and saves the execution data in 'jacoco.exec'.
classesToCover compiled classes (filtered by includes and excludes) that will be covered
clean Cleaning JaCoCo's output-directory.
compile Compiles sources.
console Starts the Scala interpreter with the project classes on the classpath.
consoleProject Starts the Scala interpreter with the sbt and the build definition on the classpath and useful imports.
consoleQuick Starts the Scala interpreter with the project dependencies on the classpath.
copyResources Copies resources to the output directory.
cover Executes the tests and creates a JaCoCo coverage report.
coveredSources Covered Sources.
Note also what it says at the beginning (wrapped for clarity):
It does not list the scopes the tasks are defined in;
use the 'inspect' command for that.
which leads to
> inspect cover
[info] No entry for key.
[info] Description:
[info] Executes the tests and creates a JaCoCo coverage report.
[info] Delegates:
[info] *:cover
[info] {.}/*:cover
[info] */*:cover
[info] Related:
[info] jacoco:cover
So you know to run jacoco:cover

Does lombok work with GWT super dev mode?

I use lombok extensively at backend, it's really nice and I hope to integrate it into GWT, so I can take advantage of the magic.
I managed to let gwt-maven-plugin recognize lombok by using the -javaagent:lombok.jar=ECJ vm args to be able to compile successfully, however, I'm not sure how to make it work with GWT super dev mode, as it continues complaining "missing getter method" in my IDE(Intellij IDEA).
Also tried the delombok goal of lombok-maven-plugin but without luck.
Any ideas?
Make sure to delete your workDir before starting gwt:run-codeserver. This directory might contain files from previous (lombok-unaware) compilation attempts.
[INFO] --- gwt-maven-plugin:2.8.0-beta1:run-codeserver (default-cli) # Web ---
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO] workDir: C:\Users\jzaruba\AppData\Local\Temp\gwt-codeserver-1653004051676437159.tmp
This is what my mvn-gwt-codeserver.bat looks like:
call mvn clean dependency:properties gwt:run-codeserver %*
(I added dependency:properties because my gwt-maven-plugin configuration refers to Lombok via project dependency: ${org.projectlombok:lombok:jar}, i.e. no static path.)
And if you don't like launching the codeserver from command line, this is how "VM arguments" in my "GWT Codeserver" launch configuration look like:
-javaagent:path/to/lombok.jar=ECJ

Runnig Twiiter Cassovary Examples in eclipse

I have imported the Twitter Cassovary into Eclipse form Git Hub but not sure how to run the examples.Please advise as I am new to eclipse as well as scala
I imported the project, opened a benchmark (cassovary-benchmarks/src/main/java/GraphGenerationBenchmarks) and used Run as->Scala application.
You can also do this from the command line. Start sbt in the main project directory, choose subproject cassovary-benchmarks and then use run. You will be asked which benchmark to run.
➜ twitter-cassovary git:(master) ✗ ls
README.md cassovary-examples project
cassovary-benchmarks cassovary-server sbt
cassovary-core lib_managed target
➜ twitter-cassovary git:(master) ✗ sbt
Loading /Users/szymon/bin/sbt-launch-lib.bash
[info] Loading global plugins from /Users/szymonmatejczyk/.sbt/0.13/plugins
[info] Loading project definition from /Users/szymon/oss/twitter-cassovary/project
[info] Set current project to cassovary (in build file:/Users/szymon/oss/twitter-cassovary/)
> project cassovary-benchmarks
[info] Set current project to cassovary-benchmarks (in build file:/Users/szymon/oss/twitter-cassovary/)
> run
[info] Compiling 12 Scala sources to /Users/szymon/oss/twitter-cassovary/cassovary-core/target/scala-2.11/classes...
[info] Compiling 56 Scala sources to /Users/szymon/oss/twitter-cassovary/cassovary-core/target/scala-2.11/classes...
[info] Compiling 2 Scala sources to /Users/szymon/oss/twitter-cassovary/cassovary- benchmarks/target/scala-2.11/classes...
[warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list
Multiple main classes detected, select one to run:
[1] com.twitter.cassovary.PerformanceBenchmark
[2] com.twitter.cassovary.SubsetSamplingBenchmarks
[3] com.twitter.cassovary.GraphGenerationBenchmarks
[4] com.twitter.cassovary.utils.FastUtilsWrappingBenchmark
Enter number: