To run the OptaPlanner examples in IntelliJ, I followed the guide in "ReadMeOptaPlanner" in "\optaplanner-distribution-7.23.0.Final":
- Open "pom.xml" as project in IntelliJ
- Edit Run Configuration.
Nevertheless, I had to change the source and target version manually to avoid errors:
- File -> Settings -> Build, Execution, Devployment -> Compiler -> Java Compiler -> Per-module bytecode version -> Target bytecode version -> 1.8
- File -> Project Structure -> Modules -> Sources -> Language level -> 8
But now I get 100 errors when building the code, for example:
Error:(24, 62) java: package org.optaplanner.persistence.common.api.domain.solution does not exist Error:(25, 64) java: package org.optaplanner.persistence.xstream.impl.domain.solution does not exist Error:(53, 12) java: cannot find symbol symbol: class SolutionFileIO location: class org.optaplanner.examples.investment.app.InvestmentApp
or
Error:(24, 48) java: package org.optaplanner.core.api.domain.solution does not exist Error:(25, 39) java: package org.optaplanner.core.api.solver does not exist Error:(26, 39) java: package org.optaplanner.core.api.solver does not exist Error:(32, 62) java: package org.optaplanner.persistence.common.api.domain.solution does not exist Error:(33, 34) java: package org.optaplanner.swing.impl does not exist Error:(34, 34) java: package org.optaplanner.swing.impl does not exist Error:(133, 15) java: cannot find symbol symbol: class Solver location: class org.optaplanner.examples.common.app.CommonApp Error:(149, 21) java: cannot find symbol symbol: class SolutionFileIO location: class org.optaplanner.examples.common.app.CommonApp Information:java: Some input files use unchecked or unsafe operations. Information:java: Recompile with -Xlint:unchecked for details.
or
Error:(23, 44) java: package com.thoughtworks.xstream.annotations does not exist Error:(24, 44) java: package com.thoughtworks.xstream.annotations does not exist Error:(25, 48) java: package org.optaplanner.core.api.domain.solution does not exist Error:(26, 48) java: package org.optaplanner.core.api.domain.solution does not exist Error:(27, 48) java: package org.optaplanner.core.api.domain.solution does not exist Error:(28, 55) java: package org.optaplanner.core.api.domain.solution.drools does not exist Error:(29, 55) java: package org.optaplanner.core.api.domain.solution.drools does not exist Error:(30, 50) java: package org.optaplanner.core.api.domain.valuerange does not exist Error:(31, 50) java: package org.optaplanner.core.api.domain.valuerange does not exist Error:(32, 50) java: package org.optaplanner.core.api.domain.valuerange does not exist Error:(33, 59) java: package org.optaplanner.core.api.score.buildin.hardsoftlong does not exist Error:(36, 74) java: package org.optaplanner.persistence.xstream.api.score.buildin.hardsoftlong does not exist Error:(38, 2) java: cannot find symbol symbol: class PlanningSolution Error:(39, 2) java: cannot find symbol symbol: class XStreamAlias Error:(50, 13) java: cannot find symbol symbol: class HardSoftLongScore location: class org.optaplanner.examples.investment.domain.InvestmentSolution Error:(98, 12) java: cannot find symbol symbol: class HardSoftLongScore location: class org.optaplanner.examples.investment.domain.InvestmentSolution Error:(102, 26) java: cannot find symbol symbol: class HardSoftLongScore location: class org.optaplanner.examples.investment.domain.InvestmentSolution Error:(111, 12) java: cannot find symbol symbol: class CountableValueRange location: class org.optaplanner.examples.investment.domain.InvestmentSolution
Unfortunately the OptaPlanner User Guide only says:
Open the file examples/sources/pom.xml as a new project, the maven integration will take care of the rest.
Thanks!
- Java: 1.8
- IDE: IntelliJ IDEA Community Edition 2019.1.3 x64
- OptaPlanner: 7.23.0
- OS: Microsoft Windows 10 Enterprise
examples/runExamples.bat
? – Andreyexamples/runExamples.bat
– oz8qdkj