5

我无法从 Groovy/Grails Tool Suite 构建我的 Grails 2.2.3 项目。战争文件名是动态的,并不总是正确设置。第一次构建会很好,但任何后续构建都将使用以前的文件名。

我正在使用@Burt Beckwith 在基于环境的 Grails 战争文件名中确定的几乎完全相同的技术来创建一个包含环境和日期/时间的战争。所以输出战争应该类似于 myapp-1.3-TEST-2013_12_02-11_31.war 或 myapp-1.3-PRODUCTION-2013_12_02-12_00.war

BuildConfig.groovy 如下:

grails.project.war.file = "target/${appName}-${appVersion}-${grails.util.Environment.current}-${new Date().format('yyyy_MM_dd-HH_mm')}.war"

如果我从命令行构建,则不存在此问题。我正在使用 Groovy/Grails Tool Suite 版本 3.3.0.Release,版本 ID 为 201307091644。Java 版本为 1.6。我在 Windows 7 64 位机器上。

我第一次运行“测试战争”时,正确生成/输出了以下内容:

Loading Grails 2.2.3
| Configuring classpath.
| Environment set to test.....
| Packaging Grails application..
| Compiling 179 source files
Note: C:\Users\me\.grails\2.2.3\projects\myapp\plugins\cache-1.0.0\src\java\grails\plugin\cache\web\GenericResponseWrapper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
| Compiling 179 source files..
| Compiling 31 source files.....
| Compiling 66 GSP files for package [myapp]..
| Compiling 4 GSP files for package [mail]..
| Building WAR file.....
| Done creating WAR target\myapp-1.3-TEST-2013_12_02-11_31.war

我第二次运行“ prod war ”时,错误地生成/输出了以下内容:

Loading Grails 2.2.3
| Environment set to production.....
| Packaging Grails application.....
| Compiling 66 GSP files for package [myapp]..
| Compiling 4 GSP files for package [mail]..
| Building WAR file.....
| Done creating WAR target\myapp-1.3-TEST-2013_12_02-11_31.war

环境和日期/时间不正确!一场新的战争取代了之前的战争,但使用了之前的环境和日期!检查战争表明这是一场生产战争(尽管文件名)。具体来说,我检查了 web.xml 并观察到显示名称的值为 /myapp-production-1.3。

如前所述,通过命令行未观察到此问题:

C:\data\GGTSWorkspace\myapp>grails prod war
| Done creating WAR target\myapp-1.3-production-2013_12_02-10_36.war

C:\data\GGTSWorkspace\myapp>grails test war
| Done creating WAR target\myapp-1.3-test-2013_12_02-10_41.war

我还创建了一个新的虚拟项目,并在这个新的虚拟项目中也观察到了这个问题,所以我目前认为这是一个 GGTS 问题/设置。

有人知道配置更改以解决此问题吗?

更新 #1:我还能够在 Windows 上使用最新的 GGTS (3.4.0) 重现此问题,并且一位同事能够在 Mac 上重现此问题。

更新 #2:我发现使用 GGTS 3.1.0(基于 Eclipse 4.2)时不存在此问题。该问题至少存在于 GGTS 3.3.0(基于 Eclipse 4.3)及更高版本上。

提前致谢!

4

1 回答 1

3

我相信,当检查“ Groovy> Grails>保持外部圣杯运行”时,就会发生这种情况。此外,似乎是一个错误,但取消选中它为我解决了这个问题。

于 2014-02-24T18:49:12.180 回答