编程语言
首页 > 编程语言> > java – 如何构建EclipseLink 2.7.0

java – 如何构建EclipseLink 2.7.0

作者:互联网

我从这里下载了eclipselink https://github.com/eclipse/eclipselink.runtime.里面有很多子项目.其中一些可以使用maven构建,一些使用蚂蚁,一些使用gradle.

但是,我想构建的org.eclipse.persistence.core是maven项目.但是当我尝试构建它(父项目)时,我得到了异常:

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

jar org.eclipse.persistence.antlr 3.5.2已经在我下载的zip中,除了它的来源之外,还可以使用ant构建.
我可以添加这个jar作为依赖,但我不认为这是正确的方法 – 因为这个zip文件中有很多jar.

问题:如何构建它?

解决方法:

事实上,pom.xml文件具有误导性,这些项目不是Maven项目,或者 – 至少 – 不是通过maven直接构建的.整个构建是一个ant构建,由于需要使用Tycho集成,因此使用Maven作为支持工具.

查看antbuild.xml ant构建文件,您会看到它通过其Java主类调用Maven(Maven是用Java构建的,入口点毕竟是旧的普通Java主目录):org.codehaus.plexus.classworlds.launcher.发射器,在其build-core目标.

所以工作流程是:

>从根文件夹启动ant build,调用ant -f antbuild.xml
>然后,Ant将调用Maven构建作为嵌套构建
>嵌套Maven构建在多模块/聚合器项目上,后者将构建几个Maven模块(子项目),从位于buildsystem / org.eclipse.persistence.parent下的根/父Maven pom.xml开始.

请注意,您需要:

> Maven 3构建它,作为上述父pom文件的先决条件.
> M2_HOME env变量集,指向你的maven安装文件夹
>使用Ant 1.9

但是,作为最小设置的一部分,默认构建将无法正常(成功)运行,因为junit缺少库,由下面的echo语句指定:

[echo] junit.lib = '${junit.lib}' (if not set tests may not compile; let alone run)

因此,最小的调用将是:

ant -f antbuild.xml -Djunit.lib=<path_to_junit_jar>

例如,您可以直接指向您的maven存储库,如下所示(这对我有用):

ant -f antbuild.xml -DC:\data\m2\repository\junit\junit\4.12\junit-4.12.jar

或者,您可以在antbuild.properties文件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

对于jmockit也应该这样做,否则会导致一些编译错误,尽管不会影响成功的构建.

可以在eclipse.moxy.test模块hereantbuild.properties文件中设置jmockit.jar属性:

#JMockit   
jmockit.jar=jmockit-1.10.jar

或者,再次,通过命令行按照以下示例:

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

上面的命令给了我一个成功的构建,根本没有编译错误.仅提供有关使用已弃用或内部API的警告.

标签:tycho,java,maven,eclipselink,maven-3
来源: https://codeday.me/bug/20190829/1757819.html