如何在Maven项目中添加Jess? [英] How to add Jess in Maven project?

查看:114
本文介绍了如何在Maven项目中添加Jess?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Pogamut库的Maven项目(在虚幻竞技场中创建机器人)。我想添加Jess,但我很难这样做。该项目构建正常但我在尝试运行时遇到各种错误(取决于当前的代码)。

I have a Maven project which uses the Pogamut library (bot creation in Unreal Tournament). I want to add Jess but I am having hard time doing so. The project builds fine but I get various errors (depending on the current code inside ) when I try to run it.

这是pom.xml文件:

Here's the pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>cz.cuni.amis.pogamut.ut2004</groupId>
        <artifactId>pogamut-ut2004-bot-pom</artifactId>
        <version>3.6.1</version>
    </parent>

    <groupId>cz.cuni.amis.pogamut.ut2004.examples</groupId>
    <artifactId>huntbot</artifactId>
    <version>3.3.1</version>
    <packaging>jar</packaging>

    <name>04-hunter-bot</name>
    <url>http://pogamut.cuni.cz</url>

    <properties>
        <bot.main.class>cz.cuni.amis.pogamut.ut2004.examples.huntbot.HunterBot</bot.main.class>
    </properties>

    <repositories>
        <repository>
            <id>amis-artifactory</id>
            <name>AMIS Artifactory</name>
            <url>http://diana.ms.mff.cuni.cz:8081/artifactory/repo</url>
        </repository>
    </repositories>



    <build>
        <plugins>
            <plugin>
                <groupId>org.dstovall</groupId>
                <artifactId>onejar-maven-plugin</artifactId>
                <version>1.4.4</version>
                <configuration>
                    <mainClass>${bot.main.class}</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

        <dependencies>

         <dependency>
          <groupId>gov.sandia</groupId>
          <artifactId>jess</artifactId>
          <version>7.1p2</version>
          <scope>system</scope>
          <systemPath>${project.basedir}/src/main/resources/jess.jar</systemPath>
         </dependency>

        </dependencies>

</project>

Jess部分是我自己添加的一些调整以使其正常工作。 systemPath文件夹中有一个jess.jar文件。

The Jess part is what I added myself along with some tweaks to get it working. There is a jess.jar file in the systemPath folder.

以下是HunterBot.java文件(唯一的.java源文件):

The following are inside the HunterBot.java file (the only .java source file):

import jess.*;
...
Rete engine;

上述两行中没有编辑错误,一切都被识别。

No editor errors in the two above lines, everything is recognized.

这是我运行项目时遇到的异常:

Here's the exception I get when I run the project:

Exception in thread "main" PogamutException[cz.cuni.amis.pogamut.ut2004.utils.UT2004BotRunner@4891a775: Agents can't be started: com.google.inject.internal.ComputationException: java.lang.NoClassDefFoundError: Ljess/Rete; (caused by: com.google.inject.internal.ComputationException: java.lang.NoClassDefFoundError: Ljess/Rete;)]


推荐答案

找到解决方案。 E L Rayle的回答帮助了我。在这里,如果有人感兴趣:如何包含本地jar文件Maven项目

Found the solution. E L Rayle's answer helped me with it. Here it is if anyone's interested: How to include local jar files in Maven project

这篇关于如何在Maven项目中添加Jess?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆