你如何将wro4j与Closure库和编译器一起使用?

时间:2011-07-24 15:10:06

标签: javascript maven google-closure-compiler google-closure google-closure-library

我按照here的说明操作,虽然我用1.3.8替换了版本,但是我可以根据需要在一个通配符文件夹中编译我的JS,但是,我不太确定放置闭包库文件,以便编译器将它们拾取。这个配置在哪里?

[INFO] Wro4j Model path: .\src\main\webapp\WEB-INF\wro.xml
[INFO] targetGroups: closure
[INFO] minimize: true
[INFO] ignoreMissingResources: false
[INFO] destinationFolder: .\src\main\webapp\wro
[INFO] jsDestinationFolder: d:\static\compiled\js
[INFO] cssDestinationFolder: d:\static\compiled\css
[INFO] folder: d:\static\compiled\css
[INFO] processing group: closure.css
[INFO] file size: closure.css -> 0 bytes
[INFO] No content found for group: closure.css
[INFO] folder: d:\static\compiled\js
[INFO] processing group: closure.js
Jul 24, 2011 10:55:59 AM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /static/compiled/js/**:1: ERROR - required "goog.dom" namespace never provided
goog.require('goog.dom');
            ^

[INFO] file size: closure.js -> 204 bytes
[INFO] d:\static\compiled\js\closure.js (204bytes) has been created!
[INFO]

1 个答案:

答案 0 :(得分:1)

将google closure所需的js资产(包含“goog.dom”对象的资源)添加到wro.xml模型中。例如:

    <groups>
      <group name="closure">
        <js>/path/to/goog-dom.js</js>
        <js>/files/*.js</js>
      </group>
    </groups>

如果这没有帮助,请在google closure&amp; amp;上发布相同的问题wro4j邮件列表(针对正确的受众)。您还可以使用快速入门项目提供更详细的示例,以帮助重现问题。