gpt4 book ai didi

gwt - 在 Maven GWT 项目中使用 Guava

转载 作者:行者123 更新时间:2023-12-04 14:51:39 24 4
gpt4 key购买 nike

我有一个项目想利用 Google Guava 库(在服务器端和客户端),但是,我在设置它时遇到了麻烦。

我能够添加 GWT 和 Guava 作为依赖项,并且我的 GWT 项目正在正确编译。我使用 Guava 的服务器端代码也可以正常工作。

但是,如果我尝试使用以下命令将其添加到我的 GWT 项目中:

<inherits name="com.google.common.collect.Collect" />

并通过 mvn gwt:run 在开发模式下使用该应用程序,它会调出谷歌开发模式界面并给出 flavor 错误:
Unable to find 'com/google/common/collect/Collect.gwt.xml' on your classpath...

大概是因为 maven 依赖项只是已编译的类文件,而不是它需要编译为 Javascript 的 source/.gwt.xml 文件。我发现如果我去 guava 网站并下载文件,就会有一个名为 guava-r08-gwt.jar 的文件,我认为它正在朝着解决方案的方向发展。

理想情况下,我可以在 Maven 中添加一些依赖项,只允许我使用 inherits 命令,但欢迎使用任何其他解决方法。

正如其中一个答案所述,这是在进行中。

同时,我为此目的建立了一个临时的公共(public) maven-repo。我不保证它会保持不变,但这里是 repo/dependency 的东西:
<repository>
<id>deepthought</id>
<name>Deepthought Public Repository</name>
<url>http://deepthought.co/maven-repo</url>
</repository>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-gwt</artifactId>
<version>r08</version>
</dependency>

不过,现在可以随意使用它。

最佳答案

关于gwt - 在 Maven GWT 项目中使用 Guava,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4904344/

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