问题描述
我有一个 maven 多模块项目.其中一个模块(编译为 .jar
)仅包含域对象,这些对象将在客户端和服务器端使用(我将此 .jar
添加为我的其他模块的依赖项)).
I have a maven multi-module project. One of this modules (compiled as .jar
) contains only domain objects, which will be used at client and server sides (I add this .jar
as dependency to other my modules).
我知道 GWT 模块(将在其中使用共享 .jar
中的对象)也必须具有成功编译的源文件.所以我尝试将两者都添加到我的 pom.xml
中:
I know that GWT module, where will be used objects from shared .jar
, must also have source files for successful compilation. So I tried to add to my pom.xml
both:
<resources>
<resource>
<directory>src/main/java/<path></directory>
<includes>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
</includes>
</resource>
</resources>
和
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<versionRange>[${gwt.version}]</versionRange>
<goals>
<goal>resources</goal>
</goals>
<plugin>
但是生成的 .jar
不包含 GWT 模块源(即 gwt.xml
).域类的所有源也被添加(在.jar
的根目录下),但ModuleName.gwt.xml
没有.
But resulting .jar
don't contain GWT module source (i.e gwt.xml
). All sources of domain classes are added as well (at root directory of .jar
), but ModuleName.gwt.xml
not.
问题出在哪里?谢谢.
推荐答案
如果你的 .gwt.xml
文件在 src/main/resources/
那么它就不会'如果您指定 src/main/java/
作为资源路径,则不会被复制...
If your .gwt.xml
file is in src/main/resources/
then it won't get copied if you specify src/main/java/
as the resource path...
您可能应该省略 <resource>
部分,让 GWT 插件将源包含在 jar 中,或者至少有两个部分,一个用于 .gwt.xml
文件(src/main/resources
或您放置它的位置)和一个用于源代码的文件(就像您现在拥有的那样).
You should probably omit the <resource>
section and let the GWT plugin include the source in the jar or at least have two sections, one for the .gwt.xml
file (src/main/resources
or where you put it) and one for the source code (as you have it now).
干杯,
这篇关于GWT.马文.GWT 模块<module_name>在项目来源或资源中找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!