I downloaded eclipselink from here https://github.com/eclipse/eclipselink.runtime. There are a lot of subprojects in it. Some of them can be built using maven, some with ant and some with gradle.
However, org.eclipse.persistence.core
which I want to build is maven project. But when I try to build it (either parent project) I get exception:
Scanning for projects...
Computing target platform for MavenProject: org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:2.7.0-SNAPSHOT @ /home/TEMP/eclipselink.runtime-master/jpa/org.eclipse.persistence.jpa.jpql/pom.xml
Fetching p2.index from http://download.eclipse.org/tools/orbit/downloads/drops/R20130827064939/repository/ (0B at 0B/s)
Adding repository http://download.eclipse.org/tools/orbit/downloads/drops/R20130827064939/repository
Fetching p2.index from http://download.eclipse.org/releases/luna/ (0B at 0B/s)
Adding repository http://download.eclipse.org/releases/luna
Fetching p2.index from http://download.eclipse.org/releases/luna/201406250900/ (0B at 0B/s)
Fetching p2.index from http://download.eclipse.org/releases/luna/201409261001/ (0B at 0B/s)
Fetching p2.index from http://download.eclipse.org/releases/luna/201501121000/ (0B at 0B/s)
Fetching p2.index from http://download.eclipse.org/releases/luna/201502271000/ (0B at 0B/s)
Resolving dependencies of MavenProject: org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:2.7.0-SNAPSHOT @ /home/TEMP/eclipselink.runtime-master/jpa/org.eclipse.persistence.jpa.jpql/pom.xml
Resolving class path of MavenProject: org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:2.7.0-SNAPSHOT @ /home/TEMP/eclipselink.runtime-master/jpa/org.eclipse.persistence.jpa.jpql/pom.xml
Computing target platform for MavenProject: org.eclipse.persistence:org.eclipse.persistence.core:2.7.0-SNAPSHOT @ /home/TEMP/eclipselink.runtime-master/foundation/org.eclipse.persistence.core/pom.xml
Resolving dependencies of MavenProject: org.eclipse.persistence:org.eclipse.persistence.core:2.7.0-SNAPSHOT @ /home/TEMP/eclipselink.runtime-master/foundation/org.eclipse.persistence.core/pom.xml
{osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86_64}
Cannot resolve project dependencies:
Software being installed: org.eclipse.persistence.core 2.7.0.qualifier
Missing requirement: org.eclipse.persistence.core 2.7.0.qualifier requires 'bundle org.eclipse.persistence.antlr 3.5.2' but it could not be found
See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
Cannot resolve dependencies of MavenProject: org.eclipse.persistence:org.eclipse.persistence.core:2.7.0-SNAPSHOT @ /home/TEMP/eclipselink.runtime-master/foundation/org.eclipse.persistence.core/pom.xml: See log for details -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
The jar org.eclipse.persistence.antlr
3.5.2
is already in zip I downloaded and there are besides sources of it, which can be built using ant.
And I could add this jar as dependency but I don't think this is the right way - because there are a lot of jars inside this zip file.
Question: how to build it?
Indeed the pom.xml
files are misleading, these projects are not Maven projects or - at least - are not meant to be built directly via maven. The whole build is an ant build which makes uses of Maven as a supporting tool because of the need of using Tycho integration.
Looking at the antbuild.xml
ant build file, you would see it is invoking Maven via its Java main class (Maven is built in Java and the entry point is an old plain Java main after all): org.codehaus.plexus.classworlds.launcher.Launcher
, in its build-core
target.
So the workflow is:
ant -f antbuild.xml
pom.xml
located under buildsystem/org.eclipse.persistence.parent
Note you would need to have:
prerequisites
of the aforementioned parent pom file.M2_HOME
env variable set, pointing at your maven installation folderHowever, as part of the minimal set-up, the default build would not run properly (successfully), because of junit
missing library, as specified by the echo
statement below:
[echo] junit.lib = '${junit.lib}' (if not set tests may not compile; let alone run)
Hence, the minimal invocation would be:
ant -f antbuild.xml -Djunit.lib=<path_to_junit_jar>
For instance, you could directly point to your maven repository as following (which worked for me):
ant -f antbuild.xml -DC:\data\m2\repository\junit\junit\4.12\junit-4.12.jar
alternatively, you can specify the path in the antbuild.properties
file, here:
# The directory that holds the oracle-specific jar files.
# You can either put the jars in this directory, or specify your own directory.
junit.lib=../extension.lib.external/junit.jar
The same should also be made for jmockit
, otherwise causing some compilation errors, althought not affecting a successful build.
The jmockit.jar
property can be set in the antbuild.properties
file of the eclipse.moxy.test
module, here:
#JMockit
jmockit.jar=jmockit-1.10.jar
Or, again, via command line as per the following example:
ant -f antbuild.xml -Djunit.lib=C:\data\m2\repository\junit\junit\4.12\junit-4.12.jar -Djmockit.jar=C:\data\m2\repository\org\jmockit\jmockit\1.10\jmockit-1.10.jar
The command above gave me a successful build, no compilation errors at all. Only warnings were present concerning usage of deprecated or internal API.