java GWT - 编译错误:没有可用于类型的源代码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11837435/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 06:34:42  来源:igfitidea点击:

GWT - Compilation error: No source code is available for type

javamavengwtcompiler-errorsgwt2

提问by Fran?ois Esthète

I am building GWT application by Maven.

我正在通过 Maven 构建 GWT 应用程序。

When compiling get the following message:

编译时得到以下消息:

Validating newly compiled units

At first there is this warning:

起初有这个警告:

[WARNING] Don't declare gwt-dev as a project dependency. This may introduce complex dependency conflicts

Then there is this error:

然后出现这个错误:

[ERROR] Line 19: No source code is available for type org.apache.commons.lang.StringUtils did you forget to inherit a required module?

Despite this build does not fall and Dev mode works properly. How can I get rid of these error messages?

尽管此构建不会下降并且开发模式正常工作。我怎样才能摆脱这些错误消息?

回答by Kapelchik

Perhaps a reason is in your module file. You should to identify packages that is to be compiled. This is configured in .gwt.xmlmodule.

也许一个原因在您的模块文件中。您应该确定要编译的包。这是在.gwt.xml模块中配置的。

<source path="packagename">

And GWT compiler will compile packages gwtxmlmodulepath.packagename.

GWT 编译器将编译包gwtxmlmodulepath.packagename

See more

查看更多

回答by David Levesque

The error means that some of the client code (to be compiled as javascript) contains a reference to the StringUtils class from Apache Commons. This is not allowed because this library contains code that is not GWT-client compatible.

该错误意味着某些客户端代码(将被编译为 javascript)包含对来自 Apache Commons 的 StringUtils 类的引用。这是不允许的,因为此库包含与 GWT 客户端不兼容的代码。