gpt4 book ai didi

java - 尽管库包含在 pom 中,但在 Maven 项目中找不到类

转载 作者:行者123 更新时间:2023-12-01 22:18:23 26 4
gpt4 key购买 nike

我正在尝试运行这个开源项目 rokuality-server(完整代码库: https://github.com/rokuality/rokuality-server )。

但是在下面的这个方法中,当我尝试实例化任何 Sikuli 类(如 PatternFinder)时,我收到了 java.lang.NoClassDefFoundError

import org.sikuli.script.Finder;
import org.sikuli.script.Image;
import org.sikuli.script.Match;
import org.sikuli.script.Pattern;

@SuppressWarnings("unchecked")
public class ImageUtils {
private static JSONObject getElement(String sessionID, String locator, File screenImage) {
JSONObject element = new JSONObject();
element.put(SessionConstants.ELEMENT_ID, UUID.randomUUID().toString());

boolean isFile = locator != null && new File(locator).exists();
boolean elementFound = false;

if (!screenImage.exists()) {
return null;
}

if (isFile) {
Finder finder = null;
float similarity = Float.valueOf(
SessionManager.getSessionInfo(sessionID).get(SessionConstants.IMAGE_MATCH_SIMILARITY).toString());
Pattern pattern = null;

try {
//******** THIS LINE BELOW THROWS THE ERROR ********
pattern = new Pattern(locator).similar(similarity);
finder = new Finder(screenImage.getAbsolutePath());
} catch (Exception e) {
Log.getRootLogger().warn(e);
}
}
// more code here
}
}

我怀疑 pom.xml 文件中的某些内容是错误的,因此这里显示的是 Sikuli X Api 依赖项:

<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>1.1.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.vidstige</groupId>
<artifactId>jadb</artifactId>
</exclusion>
<exclusion>
<groupId>com.sikulix</groupId>
<artifactId>sikulix2tigervnc</artifactId>
</exclusion>
</exclusions>
</dependency>

我尝试将版本更改为最新版本2.0.0,但它在项目中导致了一些错误,我认为这些错误与org.sikuli.script中的更改有关。 Image 类的方法。我可能需要早期版本吗?

最佳答案

这应该在 rokuality 项目的新版本中得到修复: https://github.com/rokuality/rokuality-server/releases 。这取决于用户运行的java jdk版本。

关于java - 尽管库包含在 pom 中,但在 Maven 项目中找不到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58610376/

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