Error to compile when applying Single Script Linker - gwt

Because I am creating a chrome extension with GWT project, I want to use Single Script Linker to avoid inline scripting restriction (sigh...).
And I found this resource on line: http://tech-drum.blogspot.ch/2012/08/gwt-chrome-extension-using-version-2.html
This single script linker looks like a charm, but when I really added it into my gwt.xml file and compile, it got errors... (sigh again)
The following is the error msg:
[INFO] --- gwt-maven-plugin:2.5.1:compile (default) # fake-app ---
[INFO] auto discovered modules [com.fake...]
[INFO] Compiling module com.fake.name.app
[INFO] Compiling 6 permutations
[INFO] Compiling permutation 0...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 3...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 1...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 2...
[INFO] Compiling permutation 4...
[INFO] Compiling permutation 5...
[INFO] Compile of permutations succeeded
[INFO] Linking into /path/to/fake/app
[INFO] Invoking Linker Single Script
[INFO] [ERROR] The module must have exactly one distinct permutation when using the Single Script Linker; found 6
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
What's the problem with this? It looks that permutation number (assumed as js file?) to be larger than expected, but shouldn't the linker put size restriction when creating permutations? In short, how to fix this? Thanks a lot!

Selecting just the user agent for Chrome should fix your problem.
You don't need more user-agent permutations since your extension only works with one browser.
The linker you are using is the correct one for producing just a javascript file with the code of your extension.
<set-property name="user.agent" value="safari" />

The linker runs after the code is compiled, it can't make judgements about the output until that point. This particular linker expects to produce exactly one JS file (plus images, etc perhaps, but not more code) hence 'single script'. Generating more than one permutation prevents it from doing its job.
Consider selecting a different linker, or combining all of the properties you are using (likely just user.agent) into one permutation with this in your module file (from http://code.google.com/p/google-web-toolkit/wiki/SoftPermutations):
<collapse-all-properties />

Related

Сan't run examples. Couldn't find artemis.home error

I get an error when I want to run any example through mvn verify
[ERROR] ********************************************************************************************
[ERROR] Could not locate suitable Artemis.home on either D:\Documents\IdeaProjects\activemq-artemis\examples\features\standard\security\..\..\..\.. or D:\Documents\IdeaProjects\activemq-artemis\examples\features\standard\security\..
\..\..\..\artemis-distribution\target\apache-artemis-2.18.0-SNAPSHOT-bin\apache-artemis-2.18.0-SNAPSHOT
[ERROR] Use the binary distribution or build the distribution before running the examples
[ERROR] ********************************************************************************************
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.087 s
[INFO] Finished at: 2021-02-26T22:03:39+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.activemq:artemis-maven-plugin:2.18.0-SNAPSHOT:create (create) on project security: Couldn't find artemis.home -> [Help 1]
I tried to specify the path to the directory with artemis at startup, but it does not help mvn verify -Dartemis.home="D:\Documents\apache-artemis-2.17.0"
How to fix this error?
It appears you're running the example directly from the project source since it reports 2.18.0-SNAPSHOT. If that's the case then you should do what the ERROR message indicates:
Use the binary distribution or build the distribution before running the examples
You can get a snapshot binary distribution here or you can build the distribution from the source using mvn install -Prelease -DskipTests.
If you must point the example at a different home directory you can do so using the activemq.basedir system property, e.g.:
mvn verify -Dactivemq.basedir="D:\Documents\apache-artemis-2.17.0"
Or you can change the activemq.basedir property defined in the example's pom.xml.

gwt 2.8 throws exception when compiling with guava 20

I am trying to upgrade to the newly released guava-gwt 20. I am getting this exception when I do a gwt compile. I did not get any errors prior to upgrading to guava 20. I am using the gwt 2.8.0. Is there a module I need to reference? Much appreciated!
[INFO] Tracing compile failure path for type 'java.util.concurrent.Future'
[INFO] [ERROR] Errors in 'jar:file:/Users/Eric/.m2/repository/com/google/guava/guava-gwt/20.0/guava-gwt-20.0.jar!/java/util/super/java/util/concurrent/Future.java'
[INFO] [ERROR] Line 32: No source code is available for type java.lang.InterruptedException; did you forget to inherit a required module?
[INFO] Tracing compile failure path for type 'java.util.concurrent.CountDownLatch'
[INFO] [ERROR] Errors in 'jar:file:/Users/Eric/.m2/repository/com/google/guava/guava-gwt/20.0/guava-gwt-20.0.jar!/java/util/super/java/util/concurrent/CountDownLatch.java'
[INFO] [ERROR] Line 30: No source code is available for type java.lang.InterruptedException; did you forget to inherit a required module?
[INFO] [ERROR] Aborting compile due to errors in some input files
This appears to be a Guava bug. Until we fix it, you can work around it by adding <inherits name="java.lang.Lang"/> to your .gwt.xml.

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.

No source code is available for type <xyz>; did you forget to inherit a required module?

I'm trying to add a dependency to my GWT project. The problem is that I am getting the following error:
[INFO] --- gwt-maven-plugin:1.0-beta-2:codeserver (default-cli) # mahlzeit-web ---
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO] workDir: E:\java\mahlzeit-web\mahlzeit-web\target\gwt\codeserver
[INFO] Loading Java files in com.mahlzeit.web.App.
[INFO] Tracing compile failure path for type 'com.mahlzeit.web.GoogleCalendarPanel'
[INFO] [ERROR] Errors in 'file:/E:/java/mahlzeit-web/mahlzeit-web/mahlzeit-web-client/src/main/java/com/mahlzeit/web/GoogleCalendarPanel.java'
[INFO] [ERROR] Line 54: No source code is available for type com.bradrydzewski.gwt.calendar.client.Calendar; did you forget to inherit a required module?
[INFO] [ERROR] Line 161: No source code is available for type com.bradrydzewski.gwt.calendar.client.event.DeleteHandler<T>; did you forget to inherit a required module?
[INFO] [ERROR] Line 162: No source code is available for type com.bradrydzewski.gwt.calendar.client.event.DeleteEvent<T>; did you forget to inherit a required module?
I know I would have to add something like <source ...> to my App.gwt.xml file but that is generated. I am using the gwt-maven-archetypes in Eclipse.
How can I add this dependency s.t. the GWT Compiler finds the sources in the library .jar file?
You need to add the appropriate <inherits/> to your src/main/module.gwt.xml.
The plugin will only generate those inherits for JARs that contain a META-INF/gwt/mainModule (if that's what you mean by "that is generated"), i.e. almost none of them.

Can not reflect changes using gwt-maven-plugin superdev

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.