3

因为我正在使用 GWT 项目创建一个 chrome 扩展,所以我想使用单脚本链接器来避免内联脚本限制(叹息......)。我在网上找到了这个资源:http: //tech-drum.blogspot.ch/2012/08/gwt-chrome-extension-using-version-2.html

这个单一的脚本链接器看起来很有魅力,但是当我真正将它添加到我的 gwt.xml 文件中并编译时,它出现了错误......(再次叹息)

以下是错误消息:

[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] ------------------------------------------------------------------------

这有什么问题?看起来排列数(假设为 js 文件?)比预期的要大,但是链接器在创建排列时不应该设置大小限制吗?简而言之,如何解决这个问题?非常感谢!

4

2 回答 2

3

仅选择 Chrome 的用户代理应该可以解决您的问题。

您不需要更多的用户代理排列,因为您的扩展程序仅适用于一个浏览器。

您正在使用的链接器是正确的,它仅用于生成带有扩展代码的 javascript 文件。

<set-property name="user.agent" value="safari" />   
于 2013-08-23T07:31:28.197 回答
1

链接器代码编译后运行,直到那时它才能对输出做出判断。这个特定的链接器期望只生成一个 JS 文件(可能加上图像等,但不是更多代码),因此是“单个脚本”。生成多个排列会阻止它完成工作。

考虑选择一个不同的链接器,或者将您正在使用的所有属性(可能只是 user.agent)组合成一个排列,并在您的模块文件(来自http://code.google.com/p/google-web-toolkit /wiki/SoftPermutations):

<collapse-all-properties />
于 2013-08-23T05:05:57.667 回答