這篇文章是關於從源代碼構建整個Eclipse IDE的 - 更具體的說明如何指定要爲其構建可執行文件的目標操作系統。從頭構建Eclipse IDE - 如何指定目標操作系統?
我發現下面的教程來引導我通過構建過程:http://www.vogella.com/tutorials/EclipsePlatformDevelopment/article.html
尤其是章教程13是很有幫助的。我將在這裏描述需要逐一採取的步驟 - 因此您不需要閱讀vogella教程。
需要的軟件:
顯然,你需要你的(Windows)中的機器上已安裝以下軟件:
- 的Git
- Maven版本3.3.1(請確保斌文件夾中你將提取Maven添加到PATH中,安裝說明請參閱https://maven.apache.org/install.html)
- Oracle 1.8 JDK或更高版本(不要忘記設置JAVA_HOME environmen變量t)
現在你已經準備好開始:
第1步:
在C:\
上創建一個新的文件夾。我們將其命名爲C:\myEclipse
。這將成爲我們拉取最新Eclipse版本的Git存儲庫的文件夾。
第2步:
打開Windows cmd
外殼具有管理員權限(右鍵點擊圖標cmd
如果您做了一個在桌面上,並選擇open with admin rights
)。通過命令cd C:\myEclipse
轉到該文件夾。現在輸入以下命令:git config --system core.longpaths true
。這通知Git可以在存儲庫中出現長名稱。忘記這個命令,稍後會導致錯誤。
第3步:
克隆Git倉庫:
git clone -b master --recursive git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git
現在你應該有一些耐心,對所有的源代碼得到複製到本地文件夾中。
第4步:
最後,是時候開始構建。構建過程已經需要幾個小時,所以跳過單元測試是明智的。因此,不要忘記添加-DskipTests
參數。這是開始構建的命令:
mvn clean verify -DskipTests
經過一段時間,構建應該完成。
STEP 5:
構建的結果現在應該在以下文件夾:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.releng.tychoeclipsebuilder\sdk\target\products
注意,Eclipse IDE中對所有可能的目標機器內置。 32位Windows,64位Windows,Macintosh,Linux ......難怪需要數小時!我想只爲一個目標構建 - 例如我的64位Windows機器。這將有望大幅縮短構建時間,並使我能夠更快地驗證代碼更改。
有誰知道如何做到這一點?
編輯:
我已經加入了爭論-Dnative=win32.win32.x86_64
到構建命令。不幸的是,我在15到20分鐘後出現錯誤。這個時候,我已經添加了參數-X
爲好,以獲得調試信息:
...
[INFO] equinox-sdk ........................................ SKIPPED
[INFO] org.eclipse.rcp.id ................................. SKIPPED
[INFO] org.eclipse.rcp.sdk.id ............................. SKIPPED
[INFO] org.eclipse.platform.ide ........................... SKIPPED
[INFO] org.eclipse.platform.sdk ........................... SKIPPED
[INFO] org.eclipse.sdk.ide ................................ SKIPPED
[INFO] eclipse-junit-tests ................................ SKIPPED
[INFO] eclipse.platform.repository ........................ SKIPPED
[INFO] platform-aggregator ................................ SKIPPED
[INFO] -----------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 23:54 min
[INFO] Finished at: 2016-06-19T18:12:14+02:00
[INFO] Final Memory: 668M/3263M
[INFO] -----------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8: run (natives) on project org.eclipse.swt.win32.win32.x86_64: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:915: The following error occurred while executing this line:
[ERROR] C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1
[ERROR] around Ant part ...<ant antfile="build.xml" target="build_libraries"/>... @ 4:54 in C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64\target\antrun\build-main.xml
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:
run (natives) on project org.eclipse.swt.win32.win32.x86_64:
An Ant BuildException has occured:
The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:915: The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1 around Ant part ...<ant antfile="build.xml" target="build_libraries"/>... @ 4:54 in C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64\target\antrun\build-main.xml
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by:
org.apache.maven.plugin.MojoExecutionException:
An Ant BuildException has occured:
The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:915:
The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1 around Ant part ...<ant antfile="build.xml" target="build_libraries"/>... @ 4:54 in C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64\target\antrun\build-main.xml
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:342)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64\target\antrun\build-main.xml
:4: The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml
:915:The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:568)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:443)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:313)
... 22 more
Caused by: C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml
:915: The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:568)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:443)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
... 33 more
Caused by: C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:643)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
... 46 more
[ERROR]
[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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :org.eclipse.swt.win32.win32.x86_64
我仍然沒有答案,所以我開始賞金。請重現第1步直到第5步在您的機器上(與-Dnative=win32.win32.x86_64
參數添加到第4步)。您是否僅僅爲一個操作系統目標(最好是Windows 64位)成功構建Eclipse IDE?與面向所有操作系統的一般構建過程相比,構建是否更快? PS:我還有一些與Eclipse「從頭開始構建」主題相關的其他問題。如果你有興趣:
- Building Eclipse IDE from scratch - how to choose CDT over JDT?
- Building Eclipse IDE from scratch - how to specify the target OS?
- Building Eclipse IDE from scratch - making bigger icons sometimes successful
讓我們大家團結起來,建立在Eclipse IDE自己 - 它調整到我們的需求;-)
編輯:
Mr/Mss。 Zapl寫了一個有趣的評論。他/她認爲,-Dnative
的說法是不正確的,在他/她閱讀以下鏈接: http://comments.gmane.org/gmane.comp.ide.eclipse.cbi.devel/896
希望我們能更接近現在答案:-)
最後編輯:
突然間這個問題引起了社會的關注。我在短時間內得到了很多建議/答案。我現在無法驗證它們中的每一個,因爲構建過程大約需要2個小時。
我還剩19個小時可以獲得50點獎勵。請讓我知道,如果您在自己的機器上成功複製了此問題的STEPS 1..5,併成功地從開始爲一個特定的操作系統從頭開始構建Eclipse IDE。我將授予您的獎金:-)
'EXEC返回:1'意味着從Maven構建過程調用Ant構建過程中試圖執行一些程序,但它返回一個錯誤代碼。此程序可能打印的實際錯誤消息應該在日誌中更早出現,並且可能需要一些額外的-debugverboseidontknowtheright命令選項才能看到。或者嘗試在控制檯中手動執行buildSWT.xml:1012中的命令。 – zapl
如何執行此操作:「嘗試從控制檯中手動執行buildSWT.xml中的命令:1012」?我對maven構建過程的新手太多了:-) –
我的意思是從[exec task](https://ant.apache.org/faq.html#batch-shell-execute)執行命令windows cmd窗口(這一步嘗試執行的命令似乎是'cmd/c'$ {build_dir}/$ {build_file}'$ {swt.arch} $ {xulrunner_target} install $ {clean} '但你必須弄清楚所有這些$佔位符解決的問題)。不過,我認爲在閱讀http://comments.gmane.org/gmane.comp.ide.eclipse.cbi.devel/896之後,「-Dative」是錯誤的選擇,因爲它似乎比標準構建更多的東西。 – zapl