Hi,how to complie optaplanner locally?

102 views
Skip to first unread message

jh chen

unread,
Jul 27, 2021, 12:37:19 PM7/27/21
to OptaPlanner development
my software settings:
 jdk 1.8
 maven 3.8.1
win 10
IJ idea 2021
 clone code from https://github.com/kiegroup/optaplanner.git, 8.6.x.final

after finishing maven libraries importing, 
1) i run "mvn clean" in the terminal, everything is ok.
2)i run "svn compile" or "mvn install" or other compile-related instructions,errors appeared:
the first one :
G:\optaplanner-8.6.x\optaplanner-8.6.x>mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] OptaPlanner multiproject parent
[INFO] OptaPlanner BOM (Bill Of Materials)
[INFO] OptaPlanner IDE Configuration
[INFO] OptaPlanner build parent
[INFO] OptaPlanner core
[INFO] OptaPlanner persistence
[INFO] OptaPlanner persistence common
[INFO] OptaPlanner persistence XStream
[INFO] OptaPlanner persistence JAXB
[INFO] OptaPlanner persistence Jackson
[INFO] OptaPlanner persistence JPA
[INFO] OptaPlanner persistence JSON-B
[INFO] OptaPlanner benchmark
[INFO] OptaPlanner test
[INFO] OptaPlanner Spring integration
[INFO] OptaPlanner Spring Boot autoconfigure
[INFO] OptaPlanner Spring Boot starter
[INFO] OptaPlanner Quarkus integration
[INFO] OptaPlanner Quarkus
[INFO] OptaPlanner Quarkus - Runtime
[INFO] OptaPlanner Quarkus - Deployment
[INFO] OptaPlanner Quarkus - Integration tests
[INFO] OptaPlanner Quarkus Jackson
[INFO] OptaPlanner Quarkus Jackson - Runtime
[INFO] OptaPlanner Quarkus Jackson - Deployment
[INFO] OptaPlanner Quarkus Jackson - Integration tests
[INFO] OptaPlanner Quarkus JSON-B
[INFO] OptaPlanner Quarkus JSON-B - Runtime
[INFO] OptaPlanner Quarkus JSON-B - Deployment
[INFO] OptaPlanner Quarkus JSON-B - Integration tests
[INFO] OptaPlanner examples
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OptaPlanner multiproject parent 8.6.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java-version) @ optaplanner-parent ---
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedRepositories failed with message:
Current maven session contains banned repository urls, please double check your pom or settings.xml:


Current maven session contains banned plugin repository urls, please double check your pom or settings.xml:



[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] OptaPlanner multiproject parent .................... FAILURE [  0.438 s]
[INFO] OptaPlanner BOM (Bill Of Materials) ................ SKIPPED
[INFO] OptaPlanner IDE Configuration ...................... SKIPPED
[INFO] OptaPlanner build parent ........................... SKIPPED
[INFO] OptaPlanner core ................................... SKIPPED
[INFO] OptaPlanner persistence ............................ SKIPPED
[INFO] OptaPlanner persistence common ..................... SKIPPED
[INFO] OptaPlanner persistence XStream .................... SKIPPED
[INFO] OptaPlanner persistence JAXB ....................... SKIPPED
[INFO] OptaPlanner persistence Jackson .................... SKIPPED
[INFO] OptaPlanner persistence JPA ........................ SKIPPED
[INFO] OptaPlanner persistence JSON-B ..................... SKIPPED
[INFO] OptaPlanner benchmark .............................. SKIPPED
[INFO] OptaPlanner test ................................... SKIPPED
[INFO] OptaPlanner Spring integration ..................... SKIPPED
[INFO] OptaPlanner Spring Boot autoconfigure .............. SKIPPED
[INFO] OptaPlanner Spring Boot starter .................... SKIPPED
[INFO] OptaPlanner Quarkus integration .................... SKIPPED
[INFO] OptaPlanner Quarkus ................................ SKIPPED
[INFO] OptaPlanner Quarkus - Runtime ...................... SKIPPED
[INFO] OptaPlanner Quarkus - Deployment ................... SKIPPED
[INFO] OptaPlanner Quarkus - Integration tests ............ SKIPPED
[INFO] OptaPlanner Quarkus Jackson ........................ SKIPPED
[INFO] OptaPlanner Quarkus Jackson - Runtime .............. SKIPPED
[INFO] OptaPlanner Quarkus Jackson - Deployment ........... SKIPPED
[INFO] OptaPlanner Quarkus Jackson - Integration tests .... SKIPPED
[INFO] OptaPlanner Quarkus JSON-B ......................... SKIPPED
[INFO] OptaPlanner Quarkus JSON-B - Runtime ............... SKIPPED
[INFO] OptaPlanner Quarkus JSON-B - Deployment ............ SKIPPED
[INFO] OptaPlanner Quarkus JSON-B - Integration tests ..... SKIPPED
[INFO] OptaPlanner examples ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.862 s
[INFO] Finished at: 2021-07-28T00:21:49+08:00
[INFO] Final Memory: 56M/437M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java-version) on project optaplanner-parent: Some Enforcer rules have failed. Look above for specific mess
ages explaining why the rule failed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:

is there any idea to solve this problem? thanks very much!

Radovan Synek

unread,
Jul 27, 2021, 12:44:06 PM7/27/21
to OptaPlanner development
Hello,

OptaPlanner requires at least JDK 11 to compile. The fact that you use JDK 1.8 together with the Enforcer rule failure suggests that's the problem.

You can get the JDK 11 installation for example here:

Best regards,
Radek

jh chen

unread,
Jul 27, 2021, 10:36:05 PM7/27/21
to OptaPlanner development
thanks!!i will try it right now!(* ̄︶ ̄)

Radovan Synek

unread,
Jul 28, 2021, 3:31:13 AM7/28/21
to OptaPlanner development
Hello,

there is one more thing in the excerpt you shared. The repository http://maven.aliyun.com/nexus/content/groups/public/ , probably defined in your settings.xml, does not use the https protocol which is what the enforcer plugin complains about.

Either use a URL of the repository starting with https or skip the maven enforcer plugin during compilation:
mvn clean install -Denforcer.skip

Regards

Jiří Locker

unread,
Jul 28, 2021, 4:47:22 AM7/28/21
to optapla...@googlegroups.com
I don't think JDK 11 will help here. The enforcer rule complains about a Maven repo URL. I think the problem is caused by using HTTP in the repo URL. You have two options:

1) Open your settings.xml (C:\Users\<yourname>\.m2\settings.xml) and change the repository URL to use HTTPS, so for example https://maven.aliyun.com/nexus/content/groups/public/.

2) Run Maven build with -Dinsecure.repositories=WARN option.

Regards
Jiri

--
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/optaplanner-dev/04f409be-37f5-400c-914c-a7742d7b8acan%40googlegroups.com.

Geoffrey De Smet

unread,
Jul 28, 2021, 6:04:21 AM7/28/21
to optapla...@googlegroups.com

I've seen this issue before.

Open ~/.m2/settings.xml - you'll likely have defined a http maven repository there.
I prefer to keep that settings.xml vanilla (= pretty empty), so any open source project builds on my machine as they do on CI.
On the other hand, maybe the enforcer plugin shouldn't fail on those coming from settings.xml.

With kind regards,
Geoffrey De Smet

--
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-d...@googlegroups.com.

Geoffrey De Smet

unread,
Jul 28, 2021, 6:05:12 AM7/28/21
to optapla...@googlegroups.com

I missed Jiri's response, an hour ago, which says exactly what I am saying, read that instead :)

With kind regards,
Geoffrey De Smet

jh chen

unread,
Jul 29, 2021, 4:16:39 AM7/29/21
to OptaPlanner development
Hello guys, i am so sorry to reply your so late for searching other answers. Well, i try jdk 11, but it still dosen't work. 

In this topic, my target is to modify optaplanner-core code. According to the normal procedures, it should use instructions like "mvn build, clean, compile... " to compile the source code of optaplanner. Then, i can get all the jars. Unluckly, as your can see, errors appeared.

After trying so much Google-answer, i found my own way to modify the source code:
1.git clone the code, change version to the one which you are using;
2.click "build"->"build project",then you can get all of the class files. copy the one you want to modifiy.
3.open your optaplanner-created project, found the jar. For example, in my project, the optaplanner-core would be changed. Finding the jar in "external libraries", right-click the jar, opening in "explore".
4.use 7z, winrar, or other zip software to open the jar, find the class that you want to modify. paste and replace it.
5.done.

In my way, you can use jdk8 or 11. But this is up to your optaplanner-created project. I try it with jdk11 in the first, then a explicit version error appears consequently. Therefore, i use jdk 8 to build the code and change the class, everything is ok.

Thank you sirs provid solutions in this topic, i will try them later. 

jh chen

unread,
Jul 29, 2021, 4:48:54 AM7/29/21
to OptaPlanner development
thanks for your advice, it works!!!

jh chen

unread,
Jul 29, 2021, 4:50:01 AM7/29/21
to OptaPlanner development
thanks, it works!!(* ̄︶ ̄)
Reply all
Reply to author
Forward
0 new messages