简体   繁体   English

如何使用将Tycho作为其构建系统的Maven从源构建Eclipse功能?

[英]How do I build an Eclipse feature from source that uses Maven with Tycho as its build system?

I see that a feature I want to build from HEAD (to get the benefit of bug fixes) is in git.eclipse.org. 我看到我想从HEAD构建一个功能(以获取错误修复的好处)在git.eclipse.org中。 It used to be a bit tricky to build some Eclipse features from source, but now there is Tycho which is supposed to make it easier, because it uses Maven. 从源代码构建一些Eclipse功能以前比较棘手,但是现在有了Tycho,它应该更容易使用,因为它使用了Maven。 Fortunately, I see that this feature has already been set up to use Tycho and Maven. 幸运的是,我看到已经将此功能设置为使用Tycho和Maven。

But how to use Tycho as an end-user is not exactly obvious - and I have tried running a Maven build with "clean install" as the Goal, but that failed. 但是,如何将Tycho用作最终用户并不十分清楚-我曾尝试运行以“全新安装”为目标的Maven构建,但是失败了。

Please give complete step by step instructions for how to run a Tycho build, starting with the source code checkout of the project to build, including installing any necessary software, and finishing with running Eclipse with the desired feature. 请从运行要构建的项目的源代码签出开始,包括如何安装必需的软件,以及运行具有所需功能的Eclipse来完成如何逐步运行Tycho构建的完整分步说明。

Also, what about if I want to make changes to the source code of the plugin(s) within Eclipse - does that mean I should use a different way of building it? 另外,如果我想在Eclipse中更改插件的源代码,该怎么办-是否意味着我应该使用另一种方式构建它?


FYI, this is my concrete problem that lead to the general question above: I tried to build the feature org.eclipse.linuxtools/systemtap/org.eclipse.linuxtools.systemtap-feature , and I have the systemtap plugins checked out in sibling directories (because they are part of the same git repository, so I get them for free). 仅供参考,这是导致上述常见问题的具体问题:我尝试构建功能org.eclipse.linuxtools/systemtap/org.eclipse.linuxtools.systemtap-feature ,并且在同级目录中签出了systemtap插件(因为它们是同一个git存储库的一部分,所以我免费获得了它们)。

The error is: 错误是:

[ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-source-feature-
plugin:0.14.0:source-feature (source-feature) on project org.eclipse.linuxtools.systemtap: Could not generate source feature for project MavenProject: org.eclipse.linuxtools.systemtap:org.eclipse.linuxtools.systemtap:1.2.0-SNAPSHOT @ /home/greenrd/git/org.eclipse.linuxtools/systemtap/org.eclipse.linuxtools.systemtap-feature/pom.xml
[ERROR] Missing sources for plugins [org.eclipse.linuxtools.systemtap.ui.consolelog_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.editor_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.graphingapi.ui_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.logging_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.structures_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.graphing_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.systemtapgui_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.ide_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.dashboard_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.dashboardextension_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.graphicalrun_0.3.0.201203201951]
[ERROR] -> [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/MojoExecutionException

Projects using Tycho are supposed to build like any other Maven project, ie you should be able build the project and run its tests by calling mvn clean verify in the root of the project. 使用Tycho的项目应该像任何其他Maven项目一样进行构建,即,您应该能够通过在项目的根目录中调用mvn clean verify构建该项目并运行其测试。 (If there is no pom.xml in the root, look for a project called something with "parent" or ask the project for their build entry point.) (如果根目录中没有pom.xml ,请查找一个名为“ parent”的项目,或向该项目提供其构建入口点。)

Just like in Maven, you typically won't be able to check out a project and directly build only parts of it, eg by calling mvn an eclipse-feature sub-project. 就像在Maven中一样,您通常将无法检出项目并仅直接构建项目的一部分,例如,通过将mvn称为eclipse-feature子项目。 For this to work, you first need to build the whole project once with mvn clean install and then you'll be able to also re-build parts of the project. 为此,您首先需要使用mvn clean install一次构建整个项目,然后才能重新构建项目的某些部分。

In case you do source modifications , I'd recommend to do a full build again. 如果您要进行源代码修改 ,建议再次进行完整构建。 It is possible to build only the changed sub-projects, but you'd also need to ensure manually that all aggregating project types (ie "eclipse-feature" and "eclipse-repository") are rebuilt, which is probably not worth the effort. 可以仅构建已更改的子项目,但是您还需要手动确保重建所有聚合项目类型(即“ eclipse-feature”和“ eclipse-repository”),这可能不值得。 (Unfortunately, the Maven option --also-make-dependents is currently not supported by Tycho .) (不幸的是, Tycho目前不支持 Maven选项--also-make-dependents 。)

In order to install from your local build result , you'll need to find the sub-projct that assembles the project's binaries as a p2 repository: Look for target/repository (or possibly target/site ) directories and check the features / plugins sub-folders. 为了从本地构建结果进行安装 ,您需要找到将项目二进制文件汇编为p2存储库的子项目:查找target/repository (或可能的target/site )目录,并检查features / plugins子目录-文件夹。 The repository or site folder can be used as "Local" source for the update mechanism in Eclipse. 仓库或站点文件夹可以用作Eclipse中更新机制的“本地”源。


Disclaimer: The steps described above will not work for all projects using Tycho. 免责声明:上述步骤不适用于使用Tycho的所有项目。 In case of problems, you should check the project's documentation for special instructions for running their build, or ask the project's developers. 如果出现问题,则应查看项目的文档以获取有关运行其构建的特殊说明,或咨询项目的开发人员。

mvn package usually results in packaged plugins and features using a Tycho build. mvn package通常使用Tycho构建产生打包的插件和功能。 Perhaps your failure is related to using mvn install which also involves running integration tests in the verify phase. 也许您的失败与使用mvn install有关,这也涉及在verify阶段运行集成测试。

If mvn package does not work, please add the project you're building and the error you're getting. 如果mvn package不起作用,请添加您正在构建的项目以及您遇到的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM