我正在尝试将Drool's Cookbook第 8 章中的一个简单 Drools Planner 示例改编为 OptaPlanner 6.0.1.Final 使用 groovy(已经有一个带有 maven 的工作 java 版本),类和测试在一个 groovy 脚本中,并且在同一个文件夹是solverConfig.xml和solverRules.drl,应该如何配置XmlSolverFactory以避免:
groovy technicianAssignationScript.groovy
Caught: com.thoughtworks.xstream.io.StreamException: Cannot create XmlPullParser
com.thoughtworks.xstream.io.StreamException: Cannot create XmlPullParser
at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:56)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
at org.optaplanner.core.config.solver.XmlSolverFactory.configure(XmlSolverFactory.java:84)
at org.optaplanner.core.config.solver.XmlSolverFactory.configure(XmlSolverFactory.java:74)
at org.optaplanner.core.config.solver.XmlSolverFactory.configure(XmlSolverFactory.java:67)
at org.optaplanner.core.config.solver.XmlSolverFactory$configure.call(Unknown Source)
at BestAvailableTechnicianTest.findBestTechnician(technicianAssignationScript.groovy:294)
at BestAvailableTechnicianTest$findBestTechnician.call(Unknown Source)
at technicianAssignationScript.run(technicianAssignationScript.groovy:379)
我在用着
groovy -v
Groovy Version: 2.3.0 JVM: 1.7.0_55 Vendor: Oracle Corporation OS: Linux
在脚本中使用此依赖项:
@Grapes([
@Grab("org.optaplanner:optaplanner-core:6.0.1.Final"),
@Grab("junit:junit:4.4"),
@Grab("org.optaplanner:optaplanner-benchmark:6.0.1.Final"),
// @Grab("commons-lang:commons-lang-2.6"),
@Grab("org.slf4j:slf4j-api:1.7.2"),
@Grab("ch.qos.logback:logback-classic:1.0.9"),
@Grab("com.thoughtworks.xstream:xstream:1.4.3"),
@Grab("org.jdom:jdom:1.1.3"),
@Grab("xpp3:xpp3_min:1.1.4c"),
@Grab("xmlpull:xmlpull:1.1.3.1")
])