I created a new file known as "solverConfig.xml" under resources. I changed in application.properties, to write the following: quarkus.optaplanner.solver-config-xml=src/main/resources/solverConfig.xml. However, Quarkus does not recognize the classpath. It says: Invalid quarkus.optap lanner.solverConfigXML property (src/main/resources/solverConfig.xml): that classpath resource does not exist. I followed the response of Optaplanner and Quarkus solver config update. But, it does not work.
The solverConfig.xml is configured as:
<!-- Domain model configuration -->
<solutionClass>org.acme.optaplanner.domain.TimeTable</solutionClass>
<entityClass>org.acme.optaplanner.domain.Lesson</entityClass>
<!-- Score configuration -->
<scoreDirectorFactory>
<constraintProviderClass>org.acme.optaplanner.solver.TimeTableConstraintProvider</constraintProviderClass>
</scoreDirectorFactory>
<!-- Optimization algorithms configuration -->
<termination>
<minutesSpentLimit>1</minutesSpentLimit>
</termination>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
</constructionHeuristic>
The src/main/resources
prefix isn't part of the value for that property:
Either don't have a quarkus.optaplanner.solver-config-xml
property in application.properties
, which means it will pick up src/main/resources/solverConfig.xml
(recommended, for standardization only)
Or set it explicitly to quarkus.optaplanner.solver-config-xml=solverConfig.xml
to pick up src/main/resources/solverConfig.xml
.
PS: solverConfig.xml in Quarkus doesn't need a entityClass, solutionClass or constraintProviderClass. It picks that up automatically.