尽管该库已包含在pom中,但在maven项目中找不到类

问题描述 投票:0回答:1

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

但是在下面的此方法中,当尝试实例化任何Sikuli类(例如java.lang.NoClassDefFoundErrorPattern)时,我得到的是Finder

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类的方法的更改有关。我可能需要较早的版本吗?

java maven pom.xml sikuli
1个回答
0
投票

这应该在较新版本的rokuality项目中得到解决:https://github.com/rokuality/rokuality-server/releases。它取决于用户正在运行的Java JDK版本。

© www.soinside.com 2019 - 2024. All rights reserved.