GWT 2.5 maven插件在Linux中引发了i18n代的错误

时间:2013-08-17 22:18:20

标签: gwt

GWT 2.5 maven插件在Linux中为i18n生成引发错误,但在Windows中运行完美。 我尝试使用-X选项运行,但未在日志中找到任何有用的错误说明。

            <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>${gwt.version}</version>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>generateAsync</goal>
                        <goal>i18n</goal>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <webappDirectory>${project.build.directory}/${project.build.finalName}/cms</webappDirectory>
                <hostedWebapp>target/${project.artifactId}</hostedWebapp>
                <i18nMessagesBundles>
                    <i18nMessagesBundle>package.module1.client.Messages</i18nMessagesBundle>
                    <i18nMessagesBundle>package.module2.client.Messages</i18nMessagesBundle>
                    <i18nMessagesBundle>package.module3.client.Messages</i18nMessagesBundle>
                </i18nMessagesBundles>

                <modules>
                    <module>package.module1.Module1</module>
                    <module>package.module2.Module2</module>
                    <module>package.module3.Module3</module>
                </modules>
            </configuration>
        </plugin>

有什么想法吗?

感谢。

问题堆栈跟踪如下

  

org.apache.maven.lifecycle.LifecycleExecutionException:无法在项目应用程序上执行目标org.codehaus.mojo:gwt-maven-plugin:2.5.1:i18n(默认):命令[[   / bin / sh -c / usr / lib / jvm / java-7-oracle / jre / bin / java -Xmx512m -classpath [CLASSPATH] com.google.gwt.i18n.tools.I18NSync -out / home / alex / development / camomile-cms / svn / application / target / generated-sources / gwt -createMessages com.comomile.cms.ria.fs.client.Messages   ]]状态为1失败       在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)       在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)       在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)       在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)       在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)       在org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)       在org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)       在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)       在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)       在org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)       在org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)       在org.apache.maven.cli.MavenCli.main(MavenCli.java:141)       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)       at java.lang.reflect.Method.invoke(Method.java:606)       在org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)       在org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)       在org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)       在org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)   引起:org.codehaus.mojo.gwt.shell.ForkedProcessExecutionException:Command [[   / bin / sh -c / usr / lib / jvm / java-7-oracle / jre / bin / java -Xmx512m -classpath [CLASSPATH] com.google.gwt.i18n.tools.I18NSync -out / home / alex / development / comomile / svn / application / target / generated-sources / gwt -createMessages com.comomile.cms.ria.fs.client.Messages   ]]状态为1失败       at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo $ JavaCommand.execute(AbstractGwtShellMojo.java:485)       在org.codehaus.mojo.gwt.shell.I18NMojo.doExecute(I18NMojo.java:133)       在org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:172)       在org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)       在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)       ......还有19个   [错误]   [错误]   [错误]有关错误和可能解决方案的更多信息,请阅读以下文章:   [错误] [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException   [错误]   [错误]纠正问题后,您可以使用该命令恢复构建   [错误] mvn -rf:应用程序   alex @ alex-pc:〜/ development / comomile / svn $

1 个答案:

答案 0 :(得分:0)

我在调试后找到了解决方案。

解决方案是使用大写的第一个字母创建包含消息的属性文件:例如“Messages.properties”而不是“messages.properties”

问题在于Linux对文件名区分大小写,这就是此代码段发布的原因:

String resourcePath = className.replace('.', '/') + ".properties";
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
  cl = ClassLoader.getSystemClassLoader();
}
URL r = cl.getResource(resourcePath);
if (r == null) {
  throw new FileNotFoundException("Could not find the resource '"
      + resourcePath + " matching '" + className
      + "' did you remember to add it to your classpath?");
}

在com.google.gwt.i18n.tools.I18NSync中:326。