简体   繁体   English

GWT Maven插件 - gwt:运行但gwt:compile没有。为什么?

[英]GWT Maven Plugin — gwt:run works but gwt:compile doesn't. Why?

I'm using gwt-maven-plugin to manage a GWT project. 我正在使用gwt-maven-plugin来管理GWT项目。 I use the gwt:run goal all the time to run locally in "dev mode" for testing. 我一直使用gwt:run目标在“dev模式”下本地运行以进行测试。 I now want to compile my project into a war for deployment on Tomcat. 我现在想要将我的项目编译成战争以在Tomcat上进行部署。 When I run gwt:compile , however, I get compile errors that indicate a classpath configuration issue. 但是,当我运行gwt:compile时,我收到编译错误,指出类路径配置问题。 An example: 一个例子:

Finding entry point classes
[ERROR] Errors in 'shared.MyClass.java'
[ERROR] Line 4: The import server.model.MyObject cannot be resolved

Any ideas? 有任何想法吗? Do I need to manually add the server package to some config file somewhere? 我是否需要手动将server包添加到某个配置文件中? Thanks in advance for any info. 在此先感谢您的任何信息。

-tjw -tjw

Ok, I found the problem. 好的,我发现了问题。 I found this in the GWT forums by Thomas Broyer (a GWT dev): 我在Thomas Broyer(一个GWT开发者)的GWT论坛中发现了这个:

I mean you have to "javac" classes that are referenced from annotations (in this case, the PlaceTokenizer classes referenced from @WithTokenizers; that'd be true also of your service, domain object, locator or service locator with RequestFactory, unless you use @ServiceName and @ProxyForName). 我的意思是你必须从注释中引用 “javac”类(在这种情况下,从@WithTokenizers引用的PlaceTokenizer类;对于带有RequestFactory的服务,域对象,定位器或服务定位器,也是如此,除非你使用@ServiceName和@ProxyForName)。 Otherwise, GWT can work with only the *.java files, without the *.class. 否则,GWT只能使用* .java文件,而不使用* .class。

I am trying to load in these classes from annotations since they are used with RequestFactory. 我试图从注释中加载这些类,因为它们与RequestFactory一起使用。 My question is now this: How is this restriction not completely insane? 我现在的问题是: 这个限制怎么不完全疯了?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM