【问题标题】:GWT-Maven-plugin: Link GWT compiled files into a defined directoryGWT-Maven-plugin:将 GWT 编译后的文件链接到定义的目录中
【发布时间】:2018-02-13 21:38:12
【问题描述】:

我有一个想要迁移到 Maven 的 GWT 项目。

1) 在使用 Maven 之前,为了编译 GWT,我使用以下代码执行了一个 .bat 文件:

/thisFolder是我期望的编译文件目录

call env
cd "\thisFolder"
%JAVA_HOME_GWT%/java -Xmx1024m -Dgwt.nowarn.legacy.tools  -cp  %GWT_HOME%/gwt-user.jar;%GWT_HOME%/gwt-dev.jar;%GWT_HOME%/validation-api-1.0.0.GA.jar;%GWT_HOME%/validation-api-1.0.0.GA-sources.jar;%GWT_EXT%/gwtext.jar" com.google.gwt.dev.Compiler -war "%URL_PROJECT_BASE%/%URL_COMPILE_PROJECT_CLIENT%" %*  -style OBF com.myproject.client.gwt.ProjectClient
pause

由于第二行改变了目录,所以编译后的文件创建到这个directory:...\thisFolder\com.myproject.client.gwt.ProjectClient

2) 现在我想做同样的事情,但是使用 gwt-maven-plugin,所以根据我发现的一些帖子,我对插件配置进行了一些更改以设置 @987654325 @files 输出目录到...\thisFolder

These are some of the labels I tried to use:

- <hostedWebapp>${project.build.directory}/thisFolder</hostedWebapp>
- <extraJvmArgs>-Djava.io.tmpdir=${project.build.directory}/thisFolder</extraJvmArgs>
- <outputDirectory>${project.build.directory}/thisFolder</outputDirectory>
- <war>${project.build.directory}/thisFolder</war>
- <deploy>${project.build.directory}/thisFolder</deploy>

但是在编译 GWT 之后,它会显示一条带有 directory 的消息,其中放置了 *.cache.html (or *.cache.js),这不是我预期的路径(此控制台输出中的最后一行)

[INFO]       Compiling permutation 10...
[INFO]          Compiling
[INFO]             Compiling permutation 11...
[INFO]          Compiling
[INFO]             Compiling permutation 12...
[INFO]          Compiling
[INFO]             Compiling permutation 13...
[INFO]       Compiling permutation 14...
[INFO]    Compile of permutations succeeded
[INFO]    Compilation succeeded -- 54,216s
[INFO] Linking into D:\Java\MyProject\mainProject\target\mainProject\com.myproject.client.gwt.ProjectClient

设置*.cache.html 文件输出目录的正确方法是什么?


这是pom.xml gwt 插件配置:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>${gwt.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>generateAsync</goal>
                <goal>test</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <extraJvmArgs>-Xmx1024m -Xss1024k -Dgwt.nowarn.legacy.tools</extraJvmArgs>
        <draftCompile>true</draftCompile>
        <debugSuspend>false</debugSuspend>
        <logLevel>INFO</logLevel>
        <style>OBF</style>
        <noServer>true</noServer>
        <runTarget>http://localhost:${glassfish.port}/${project.build.finalName}/${project.build.finalName}.html</runTarget>
        <buildOutputDirectory>${project.build.outputDirectory}</buildOutputDirectory>
        <deploy>${project.build.outputDirectory}/deploy</deploy>
        <copyWebapp>true</copyWebapp>
    </configuration>
</plugin>

【问题讨论】:

    标签: java eclipse maven gwt maven-plugin


    【解决方案1】:

    来自https://gwt-maven-plugin.github.io/gwt-maven-plugin/compile-mojo.html 的文档,

    webappDirectory 文件 - GWT 将写入输出文件的文件系统上的位置(GWTCompiler 的 -out 选项)。 默认值为:${project.build.directory}/${project.build.finalName}。 用户属性是:gwt.war。

    您似乎使用的是-war,我认为这是-out 的旧版本,但将&lt;webappDirectory&gt;${project.build.directory}/thisFolder&lt;/webappDirectory&gt; 添加到您的配置中应该可以达到预期的效果。

    【讨论】:

    • 实际上,-outGWTCompiler-warCompiler更老的版本 ;-)
    猜你喜欢
    • 1970-01-01
    • 2017-11-26
    • 1970-01-01
    • 1970-01-01
    • 2014-12-04
    • 2012-10-31
    • 1970-01-01
    • 2014-07-23
    • 1970-01-01
    相关资源
    最近更新 更多