gpt4 book ai didi

java - GWT。排除共享域对象以分离 Maven 模块

转载 作者:行者123 更新时间:2023-11-29 05:52:51 25 4
gpt4 key购买 nike

我有一些域类,例如 StudentUser 等,它们在服务器端和客户端 (gwt) 端使用。

我可以排除这个域类来分离 maven 模块,这样我就可以将这个模块作为依赖添加到其他 maven 模块(即将这个模块作为依赖添加到包含 gwt 相关的 maven 模块东西,所以这个域类将生成为 JavaScript,并将这个模块作为依赖项添加到“普通”(不是 gwt)Java maven-modules,所以这个域类不会生成为 JavaScript)?

最佳答案

是的,为什么不呢?考虑以下结构:

root-pom--->common
|
+-->frontend
|
+-->backend

frontendbackend 依赖于 common 并将您的域对象放在 common 中。

你应该记得有 *.gwt.xml 文件在 common 项目中公开你的 VO,并将其包含在你的 frontendgwt.xml 描述符,例如。

<module>
<source path="your.vo.package" />
</module>

并且 - 正如 Thomas Broyer 指出的那样 - 请记住使源代码可用于 frontend,但这不一定必须在单独的 jar 中。您可以将源代码与 .class 文件打包在一起。 gwt-maven-plugingwt:resources 目标可用于此目的:

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>

干杯,

关于java - GWT。排除共享域对象以分离 Maven 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13268158/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com