gpt4 book ai didi

java - GWT-Maven-插件 : Link GWT compiled files into a defined directory

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:49:31 25 4
gpt4 key购买 nike

我有一个 GWT 项目,我想将其迁移到 Maven。

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,所以根据我发现的一些帖子,我对插件配置做了一些更改以设置 *.cache.html文件输出目录到...\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 之后,它会显示一 strip 有 directory 的消息*.cache.html(或 *.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>

最佳答案

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

webappDirectory File - Location on filesystem where GWT will write output files (-out option to GWTCompiler). Default value is: ${project.build.directory}/${project.build.finalName}. User property is: gwt.war.

您似乎在使用 -war相反,我认为这是 -out 的更旧版本, 但添加 <webappDirectory>${project.build.directory}/thisFolder</webappDirectory>您的配置应该达到预期的结果。

关于java - GWT-Maven-插件 : Link GWT compiled files into a defined directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46057546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com