无法从jar文件执行OptaPlanner 7.21.0-目录dataDir错误

时间:2019-07-08 07:02:38

标签: java optaplanner

当我完成我的应用程序并将其导出到其他计算机时,我正在尝试创建我的可执行jar。但是,我得到指示的错误。有什么建议吗?

我已经按照POM尝试了具有依赖性和阴影的Jar

details:=[][]string{}
for rows.Next() {
    cols := make([]string, num_cols)
    // Create an array of string pointers pointing to the column strings.
    col_ptrs = make([]*string, num_cols)
    for i := 0; i < num_cols; i++ {
        col_ptrs[i] = &cols[i];
    }
    rows.Scan(col_ptrs...)
    details = append(details, cols)
}

例外:

<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>
    <groupId>org.optaplanner.examples.nurserostering</groupId>
    <artifactId>NurseRostering</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Staff Rostering</name>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.swt -->
        <dependency>
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-core</artifactId>
            <version>7.21.0.Final</version>
        </dependency>
        <dependency>
            <groupId>com.mchange</groupId>
            <artifactId>mchange-commons-java</artifactId>
            <version>0.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.4.10</version>
        </dependency> <!-- Internal dependencies -->
        <dependency>
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-persistence-common</artifactId>
            <version>7.21.0.Final</version>
        </dependency>
        <dependency><!-- Most examples use the XStream integration -->
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-persistence-xstream</artifactId>
            <version>7.21.0.Final</version>
        </dependency>
        <dependency><!-- TODO add examples that use the JAXB integration -->
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-persistence-jaxb</artifactId>
            <version>7.21.0.Final</version>
        </dependency>
        <dependency><!-- TODO add examples that use the jackson integration -->
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-persistence-jackson</artifactId>
            <version>7.21.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-benchmark</artifactId>
            <version>7.21.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-test</artifactId>
            <scope>test</scope>
            <version>7.21.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-api</artifactId>
            <version>7.21.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
            <scope>runtime</scope>
            <version>7.21.0.Final</version>
        </dependency>
        <!-- External dependencies -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.jfree</groupId>
            <artifactId>jfreechart</artifactId>
            <version>1.0.19</version>
        </dependency>
        <dependency>
            <groupId>org.jfree</groupId>
            <artifactId>jcommon</artifactId>
            <version>1.0.23</version>
        </dependency>
        <!-- Common utils -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>20.0</version>
        </dependency>
        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>runtime</scope>
            <version>1.1.3</version>
        </dependency>


        <!-- Examples only dependencies. -->
        <!-- WARNING: every examples only dependency must be properly dealt with 
            in optaplanner-distribution/src/main/assembly/assembly-optaplanner.xml -->
        <!-- Converters -->
        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.15</version>

        </dependency>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
            <version>2.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>3.6.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.4.0-b180830.0438</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.24</version>
        </dependency>
        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-javafx</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>13-ea+9</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>13-ea+9</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>13-ea+9</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-fontawesome-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-core</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.4.3.Final</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-base</artifactId>
            <version>13-ea+9</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-octicons-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-fontelico-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-ionicons-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-ionicons4-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-entypo-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-themify-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-materialdesign-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-foundation-pack</artifactId>
            <version>11.3.4</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <!-- Run shade goal on package phase -->
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <!-- add Main-Class to manifest file -->
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>org.optaplanner.examples.nurserostering.app.NurseRosteringApp</mainClass>

                                    <!-- -Dlog4j.configurationFile=../properties/idStrikeSolver-log4j.properties 
                                        -Duser.timezone="UTC" -->
                                </transformer>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/kie.conf</resource>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

1 个答案:

答案 0 :(得分:1)

让我通过复制粘贴问题来回答这个问题:)

  

...目录dataDir(/home/rodney/Desktop/data/nurserostering)执行   不存在。 工作目录都应设置为   包含data目录的目录(不是   data目录本身)或...数据目录在   git clone(optaplanner/optaplanner-examples/data)和发行版zip中   (examples/sources/data)。在IDE(IntelliJ,Eclipse,NetBeans)中,   打开“运行配置”以更改“工作目录” ...