UniTime / unitime

Comprehensive University Timetabling System
http://www.unitime.org
Apache License 2.0
274 stars 162 forks source link

Maven build failure #115

Closed jgfoster closed 2 years ago

jgfoster commented 2 years ago

I've created a Docker image with the following:

FROM ubuntu:22.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y git vim
RUN git clone https://github.com/UniTime/unitime.git /opt/unitime
WORKDIR /opt/unitime
RUN apt-get install -y maven
ENTRYPOINT bash

Then I ran mvn package (following these instructions) and after over six minutes of downloads, got the following:

Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/poi/poi/3.17/poi-3.17.jar (2.7 MB at 45 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:27 min
[INFO] Finished at: 2022-07-26T19:21:25Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project unitime: Could not resolve dependencies for project org.unitime:unitime:jar:4.7: Could not find artifact org.unitime:cpsolver:jar:1.4-SNAPSHOT in maven-restlet (https://maven.restlet.org) -> [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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Any advice?

tomas-muller commented 2 years ago

We have recently moved our nightly/snapshot builds of cpsolver-1.4 to GitHub (see here), but it looks like it does not publish the snapshot builds as advertised. I think we will need to move back to Sonatype's SNAPSHOT repository.

In the meantime, UniTime 4.6 should build just fine (maint_UniTime46 branch), but UniTime 4.7 (master branch) will fail unless you install CPSolver first. That is:

git clone https://github.com/UniTime/cpsolver.git
cd cpsolver
mvn install
jgfoster commented 2 years ago
#12 132.0 [INFO] ------------------------------------------------------------------------
#12 132.0 [INFO] BUILD FAILURE
#12 132.0 [INFO] ------------------------------------------------------------------------
#12 132.0 [INFO] Total time:  02:08 min
#12 132.0 [INFO] Finished at: 2022-07-27T00:53:05Z
#12 132.0 [INFO] ------------------------------------------------------------------------
#12 132.0 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (attach-javadocs) on project cpsolver: MavenReportException: Error while creating archive: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. -> [Help 1]
#12 132.0 [ERROR] 
#12 132.0 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
#12 132.0 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
#12 132.0 [ERROR] 
#12 132.0 [ERROR] For more information about the errors and possible solutions, please read the following articles:
#12 132.0 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
------
executor failed running [/bin/sh -c cd cpsolver && mvn install]: exit code: 1
tomas-muller commented 2 years ago

The issue appears to be

Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set.

so the build is not able to create the documentation for the cpsolver.

Do you have javadoc installed? It should be in the same folder as java and javac commands. Running mvn --version will tell you which version of Java Maven is using and where it expects it to be located.

jgfoster commented 2 years ago

With the following Dockerfile, I was able to do mvn package and it finished successfully in 1 hr 39 minutes:

# docker build --tag unitime .
# docker run --rm --name unitime -it unitime

FROM ubuntu:22.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y git vim openjdk-8-jdk
RUN apt-get install -y ant
RUN apt-get install -y maven 
RUN git clone https://github.com/UniTime/unitime.git /opt/unitime
RUN git clone https://github.com/UniTime/cpsolver.git /opt/unitime/cpsolver
WORKDIR /opt/unitime
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN cd cpsolver && mvn install
ENTRYPOINT bash
# mvn package

Even for those not using Docker, this could be good documentation for those doing a setup.