从头开始构建Eclipse IDE - 如何指定目标OS? [英] Building Eclipse IDE from scratch - how to specify the target OS?

查看:486
本文介绍了从头开始构建Eclipse IDE - 如何指定目标OS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这文章是关于从源头code栋整个Eclipse IDE中 - 尤其是更多的如何指定要生成的可执行目标OS

This post is about building the whole Eclipse IDE from the source code - and more in particular how to specify the target OS you want to build the executable for.

在这里输入的形象描述

我发现下面的教程来指导我通过构建过程: HTTP:// WWW .vogella.com /教程/ EclipsePlatformDevelopment / article.html

I found the following tutorial to guide me through the build procedure: http://www.vogella.com/tutorials/EclipsePlatformDevelopment/article.html

特别是教程的第13章是很有帮助的。我将描述需要由一个在这里采取一个步骤 - 这样你就不会需要阅读vogella教程

Especially chapter 13 of that Tutorial is helpful. I will describe the steps that need to be taken one by one here - so you don't need to read the vogella tutorial.

所需的软件:

显然,你需要你的(Windows)中的机器上已经安装以下软件:

Apparently you need to have the following software installed on your (Windows) machine:


  • 的Git

  • Maven版本3.3.1(确保你在哪里Maven的提取bin文件夹添加到PATH。安装指导参见的 https://maven.apache.org/install.html

  • 甲骨文JDK 1.8或更高版本(不要忘记设置JAVA_HOME环境变量)

现在你已经准备好启动:

Now you're ready to start:

第1步:

创建了 C上新建一个文件夹:\\ 磁盘。让我们将其命名为 C:\\ MYECLIPSE 。这将是我们拉的最新Eclipse版本的Git仓库的文件夹。

Create a new folder in the C:\ disk. Let's name it C:\myEclipse. This will be the folder in which we pull the Git repository of the latest Eclipse version.

第2步:

打开Windows CMD 外壳具有管理员权限(右键点击 CMD 图标,如果你在桌面上做了​​一个,然后选择以管理员权限打开)。通过命令进入该文件夹 CD C:\\ MYECLIPSE 。现在,键入以下命令:混帐配置--system core.longpaths真正。这将通知Git的,长期的名字可以在库中发生。忘了这个命令,它会导致错误以后。

Open the Windows cmd shell with administrator privileges (right click on cmd icon if you made one on your desktop, and select open with admin rights). Go to that folder through the command cd C:\myEclipse. Now type the following command: git config --system core.longpaths true. This notifies Git that long names can occur in the repository. Forget this command and it will result in errors later on.

第三步:

克隆Git仓库:

git clone -b master --recursive git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git

现在你应该有一些耐心所有源$ C ​​$ C到被复制到本地文件夹中。

Now you should have some patience for all the sourcecode to get copied to your local folder.

第四步:

最后,是时候开始构建。构建过程将已经在服用小时,因此它是明智的跳过单元测试。因此,不要忘记添加 -DskipTests 参数。这是开始构建的命令:

Finally it is time to start the build. The build procedure will already take hours, so it is wise to skip the unit tests. Therefore do not forget to add the -DskipTests parameter. This is the command to start the build:

mvn clean verify -DskipTests

几个小时后,构建应完成。

After some hours, the build should be finished.

第五步:

构建的结果现在应该在以下文件夹:

The results of the build should now be in the following folder:

<$c$c>C:\\myEclipse\\eclipse.platform.releng.aggregator\\eclipse.platform.releng.tychoeclipsebuilder\\sdk\\target\\products

注意,Eclipse IDE中对所有可能的目标机器内置。 32位Windows,64位Windows,Macintosh上,Linux的,......难怪它需要时间!我想建立只是一个单一的目标 - 例如我的64位Windows计算机。希望这将显著缩短建造时间,并让我验证code的变化较迅速。

Notice that the Eclipse IDE is built for all possible target machines. 32-bit Windows, 64-bit Windows, Macintosh, Linux, ... No wonder it takes hours! I would like to build for just one single target - for example my 64-bit Windows machine. This will hopefully reduce the build time significantly and allow me to verify code changes quicker.

有谁知道如何实现这一目标?

Does anyone know how to achieve this?

编辑:

我已经加入参数 -Dnative = win32.win32.x86_64 来构建命令。不幸的是,我后15至20分钟,得到一个错误。这一次,我已经添加了参数 -X 为好,以获得调试信息:

I have added the argument -Dnative=win32.win32.x86_64 to the build command. Unfortunately, I get an error after 15 to 20 mins. This time, I've added the argument -X as well, to get debug information:

                      ...

[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 参数添加到第四步骤)。你实现了Eclipse IDE的成功构建,只是一个OS目标(preferably Windows 64位)?请问构建走得更快 - 相比于针对所有操作系统的一般的构建过程。


I still have no answer, so I started a bounty. Please reproduce step 1 until step 5 on your machine (with the -Dnative=win32.win32.x86_64 argument added to the fourth step). Do you achieve a successful build of the Eclipse IDE for just one OS target (preferably Windows 64-bit)? Does the build go faster - compared to the general build process that targets all OS's?

PS:我有相关的Eclipse的主题是从头开始构建的一些其他问题。如果你有兴趣:

PS: I've got some other questions related to the Eclipse "Build from scratch" topic. If you're interested:

  • 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自己 - 它调整到我们的需求; - )

Let us all unite to build the Eclipse IDE ourselves - and tweak it to our needs ;-)

编辑:

先生/​​的Mss。 Zapl写了一个有趣的评论。他/她认为 -Dnative 的说法是不正确的,在他/她读以下链接:
http://comments.gmane.org/gmane.comp.ide .eclipse.cbi.devel / 896

Mr/Mss. Zapl wrote an interesting comment. He/She thinks that the -Dnative argument is not correct, after he/she read the following link: http://comments.gmane.org/gmane.comp.ide.eclipse.cbi.devel/896

希望我们能更接近现在答案: - )

Hopefully we'll get closer to the answer now :-)

最后编辑:

突然,这个问题擦肩而过,社会的关注。我得到了很多建议/答案在很短的时间。我无法验证他们每一个人,因为现在的构建过程大约需要2个小时。

Suddenly this question catched the attention of the community. I got a lot of suggestions/answers in a short time. I cannot verify every single one of them right now because the build procedure takes about 2 hours.

我已经离开奖50分赏金19小时。请让我知道,如果你成功地再现自己的机器上,从这个问题的步骤1..5,并成功地的从头开始构建Eclipse IDE的一个特定的操作系统的。我将授予你的奖金: - )

I have 19 hours left to award the 50 points bounty. Please let me know if you successfully reproduced the STEPS 1..5 from this question on your own machine, and succeeded to build the Eclipse IDE from scratch for one specific OS. I will award you the bonus :-)

推荐答案

这个片断是从一个工作的pom.xml采取出口win32.win32.x86_64。
也许有些地方不需要为您的项目,但它可能是一个很好的起点,以添加到您的POM文件。

This snippet is taken from a working pom.xml that exports to win32.win32.x86_64. Maybe some parts are not required for your project but it may be a good starting point to add this to your pom file.

..
..
<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>0.20.0</version>
            <extensions>true</extensions>
        </plugin>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>target-platform-configuration</artifactId>
            <version>0.20.0</version>
            <configuration>
                <resolver>p2</resolver>
                <environments>
                    <environment>
                        <os>win32</os>
                        <ws>win32</ws>
                        <arch>x86_64</arch>
                    </environment>
                </environments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-compiler-plugin</artifactId>
            <version>0.20.0</version>
            <configuration>
                <compilerArgument>-err:-forbidden</compilerArgument>
            </configuration>
        </plugin>
    </plugins>
</build>
..
..

修改

由于在评论中提到我跟着你的脚步,并出现了一些问题。我现在解决了其中的大部分。如果其他人也得到了很多的错误这里有一些解决方案。

As mentioned in the comments I followed your steps and had some problems. I solved most of them now. If someone else also gets a lot of errors here are some solutions.


  • 在文件eclipse.pde.ui / pom.xml的第19行:该版本是4.6.0-SNAPSHOT,但必须是4.7.0-SNAPSHOT

  • In the file eclipse.pde.ui/pom.xml line 19: the version was 4.6.0-SNAPSHOT, but has to be 4.7.0-SNAPSHOT

提示:为了加快您可以添加例如构建-T 4到MVN命令启用并行编译。我终于结束> MVN清洁验证-DskipTests -T 4 -Dnative = win32.win32.x86_64

Hint: To speed up the build you can add e.g. "-T 4" to the mvn command to enable parallel builds. I finally ended with >mvn clean verify -DSkipTests -T 4 -Dnative=win32.win32.x86_64

此修复程序,我能够运行,直到我得到了最初的问题中提到的同样的错误了。
我到项目文件夹\\ eclipse.platform.swt.binaries \\包\\ org.eclipse.swt.win32.win32.x86_64,并开始一个Ant构建(Apache Ant的版本1.9.7),它完成没有错误。但我得到了同样的错误,当它被Maven构建执行。
因此,我检查线路915和文件\\ eclipse.platform.swt \\包\\ org.eclipse.swt \\ buildSWT.xml 1012。设置failonerror后=假(设置为真默认情况下)中的两条线,我能够继续与构建。的我估计这是一个非常贫穷的解决方案,它不应该是一个问题,禁用此类试验的最终解决方案。

After this fix I was able to run until I got the same errors mentioned in the initial question. I went to the project folder \eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64 and started an Ant build (Apache Ant version 1.9.7) and it finished without errors. But I got the same errors when it was executed by the Maven build. Thus, I checked lines 915 and 1012 of the file \eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml. After setting failonerror="false" (is set to "true" by default) in both lines I was able to continue with the build. I assess this as a very poor solution and it should not be the final solution for a problem to disable such tests.

最后,我在项目org.eclipse.pde.build.tests错误结束,停止跟随的问题。
整个项目似乎许多地方配置错误,我无法找到一个更好的解决方案为止。人们应该记住的金科玉律不要犯任何故障构建以避免此类问题。也许问题会经过几次更新回购来解决。

Finally, I ended with errors in project org.eclipse.pde.build.tests and stopped following the problems. The whole project seems to be misconfigured in many parts and I could not find a better solution so far. People should remember the golden rule not to commit anything that breaks the build to avoid such problems. Maybe the problems will be solved after a few updates to the repo.

这篇关于从头开始构建Eclipse IDE - 如何指定目标OS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆