简体   繁体   English

如何使用本地目录作为Tycho构建的目标平台?

[英]How can I use a local directory as target platform for a Tycho build?

I want to build an RCP-Application with a target platform which is a directory with Maven/Tycho. 我想用目标平台构建一个RCP-Application,这是一个Maven / Tycho目录。
Now I have some troubles that the dependencies could not be resolved. 现在我遇到了一些无法解决依赖关系的麻烦。

Internal error: java.lang.RuntimeException: "No solution found because the  
problem is unsatisfiable.": ["Unable to satisfy dependency from  
de.test.prototype.main 1.0.0.qualifier to bundle org.eclipse.ui 0.0.0.",  
"Unable to satisfy dependency from de.test.prototype.main 1.0.0.qualifier  
to bundle org.eclipse.core.runtime 0.0.0.", ...

All in all there are several dependency resolution problems, so I think Tycho can't use my target platform. 总而言之,有几个依赖性解决问题,所以我认为Tycho不能使用我的目标平台。
I read http://wiki.eclipse.org/Tycho/Target_Platform and there is the following note: 我阅读了http://wiki.eclipse.org/Tycho/Target_Platform ,其中有以下注释:

The location types "Directory", "Installation", and "Features" are not supported." 不支持位置类型“目录”,“安装”和“功能”。“

So my question is: How do I get Tycho to use my target platform, although it is a directory? 所以我的问题是:我如何让Tycho使用我的目标平台,虽然它是一个目录?

Tycho requires p2 metadata in order to resolve dependencies in your build. Tycho需要p2元数据才能解决构建中的依赖关系。 This is why a folder with just bundles and features can't be used. 这就是无法使用仅具有捆绑包和功能的文件夹的原因。

However you can convert your folder into a p2 repository by using the Features and Bundles Publisher Application . 但是,您可以使用Features and Bundles Publisher Application将文件夹转换为p2存储库。 After you have done this, you can to reference the folder as "Software Site" location through a file: URL in your target definition file. 完成此操作后,您可以通过目标定义文件中的file: URL将该文件夹作为“软件站点”位置引用。 Then Tycho will also be able to use it. 然后第谷也将能够使用它。

Note however that you should first be asking yourself if you really need to do this: Are the features and bundles in your folder really not available in any p2 repository? 但是请注意,您首先应该问自己是否真的需要这样做:文件夹中的功能和包是否真的在任何p2存储库中都不可用? If they are, it is strongly recommended to not run the Features and Bundles Publisher on them (or you may be causing violations of basic assumptions of p2 which may lead to problems that are typically only visible to your users). 如果是,则强烈建议不要在它们上运行Features and Bundles Publisher(或者您可能导致违反p2的基本假设,这可能导致通常仅对您的用户可见的问题)。 Instead, you should reference these features and bundles directly from the p2 repository, eg via "Software Site" location in your target file. 相反,您应该直接从p2存储库引用这些功能和包,例如通过目标文件中的“软件站点”位置。

Create a repo from your plug-ins and upload it to a http server ( like apache ) and point your tycho pom to the repo 从插件创建一个repo并将其上传到http服务器(如apache)并将你的tycho pom指向repo

This example is for the mac and eclipse 4 but with some tweaking you can make it work on other platforms. 这个例子适用于mac和eclipse 4,但通过一些调整,你可以使它在其他平台上运行。

first create a src folder on the desktop. 首先在桌面上创建一个src文件夹。 In this folder create 2 folders : features plugins 在此文件夹中创建2个文件夹:功能插件

Now copy your plugins in the plugins folder and features in the features folder. 现在将插件复制到插件文件夹和features文件夹中的功能。

Then create an empty destination folder somewhere ( upload this folder to your server) 然后在某处创建一个空的目标文件夹(将此文件夹上传到您的服务器)

for this example I created both my folders on the desktop to keep it simple 对于这个例子,我在桌面上创建了两个文件夹以保持简单

Then I do this : 然后我这样做:

destination folder : /Users/yves/Desktop/repo
source folder : /Users/yves/Desktop/src

Terminal app : cd /Applications/Eclipse4

./eclipse  -debug -consolelog -nosplash -verbose -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/Users/yves/Desktop/repo -artifactRepository file:/Users/yves/Desktop/repo -source /Users/yves/Desktop/src -compress -append -publishArtifacts

The repo folder now contains a repo of your target platform. repo文件夹现在包含目标平台的repo。 Upload it, adjust the pom and build. 上传它,调整pom和构建。

According to my exprerience, Tycho supports only online p2 repositories. 根据我的表现,Tycho仅支持在线 p2存储库。 It refuses to work with a p2 repo located on a local disk. 它拒绝使用位于本地磁盘上的p2 repo。 Strange, but true. 奇怪但真实。

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

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