Dear Pardheev,
The CPSolver can be built using Apache Ant or Maven.
First, you need to clone the Git repository:
Cloning into 'cpsolver'...
remote: Enumerating objects: 18019, done.
remote: Counting objects: 100% (893/893), done.
remote: Compressing objects: 100% (351/351), done.
remote: Total 18019 (delta 474), reused 846 (delta 433), pack-reused 17126
Receiving objects: 100% (18019/18019), 26.30 MiB | 9.87 MiB/s, done.
Resolving deltas: 100% (11176/11176), done.
Second, to build using Maven, execute
mvm package in the cpsolver folder
cd cpsolver
mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.unitime:cpsolver >------------------------
[INFO] Building CPSolver 1.4-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
...
[INFO] Building jar: /Users/muller/Test/Build/cpsolver/target/cpsolver-1.4-SNAPSHOT-javadoc.jar
[INFO]
[INFO] --- assembly:2.3:single (make-assembly) @ cpsolver ---
[INFO] Reading assembly descriptor: distribution.xml
[INFO] Building zip: /Users/muller/Test/Build/cpsolver/target/cpsolver-1.4-SNAPSHOT-dist.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.908 s
[INFO] Finished at: 2023-12-23T13:33:37+01:00
[INFO] ------------------------------------------------------------------------
The resultant JAR is placed in the target folder: target/cpsolver-1.4-SNAPSHOT.jar. It is also included inside of the target/cpsolver-1.4-SNAPSHOT-dist.zip distribution.
Or using Apache Ant calling ant in the
cpsolver filter (root folder of the cpsolver repository):
cd cpsolver
ant
Buildfile: /users/muller/test/cpsolver/build.xml
clean:
init:
[mkdir] Created dir: /Users/muller/Test/Build/cpsolver/tmp
[mkdir] Created dir: /Users/muller/Test/Build/cpsolver/dist/bin
[echo] Source files: /Users/muller/Test/Build/cpsolver/src
[echo] Libs: /Users/muller/Test/Build/cpsolver/lib
...
dist:
[mkdir] Created dir: /Users/muller/Test/Build/cpsolver/dist/lib
[copy] Copying 3 files to /Users/muller/Test/Build/cpsolver/dist/lib
[zip] Building zip: /Users/muller/Test/Build/cpsolver/dist/cpsolver-1.4_bld1.zip
The resultant JAR is under dist/bin/cpsolver-all-1.4.jar (or inside of the dist/cpsolver-1.4_bld1.zip).
For running the example, please place the cpsolver library in the same folder as the dependencies (dom4j-2.1.4.jar, log4j-api-2.20.0.jar, log4j-core-2.20.0.jar -- these are also included in the distribution zip file). For example:
java -Xmx1g -cp cpsolver-1.4-SNAPSHOT.jar org.cpsolver.ifs.example.csp.SimpleTest
Alternatively, you can include all the dependencies in the classpath. For example (using the locations from the Git repository and Maven build):
java -Xmx1g -cp target/cpsolver-1.4-SNAPSHOT.jar:lib/dom4j-2.1.4.jar:lib/log4j-api-2.20.0.jar:lib/log4j-core-2.20.0.jar org.cpsolver.ifs.example.csp.SimpleTest
java -Xmx1g -cp target/cpsolver-1.4-SNAPSHOT.jar:lib/dom4j-2.1.4.jar:lib/log4j-api-2.20.0.jar:lib/log4j-core-2.20.0.jar org.cpsolver.ifs.example.csp.Test csp-example.cfg
See the attached configuration csp-example.cfg.
Best regards,
Tomas Muller
UniTime