Sca*_*orn 3 eclipse eclipse-plugin tycho maven
我的工作区中有一个插件和一个功能项目.当我通过文件>导出为>功能手动导出功能时,一切正常.我正在尝试编写一个自动插件构建和导出脚本来摆脱这些苦差事.我将功能项目转换为Maven项目并填充pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MyProject</groupId>
<artifactId>NMGDBPluginFeature</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<properties>
<tycho-version>0.22.0</tycho-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>eclipse-luna</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/luna</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
但脚本抛出:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: NMGDBPluginFeature.feature.group 1.0.0.qualifier
[ERROR] Missing requirement: NMGDBPluginFeature.feature.group 1.0.0.qualifier requires 'GDBFifoBlocks [1.0.0.gdbfifoblocks]' but it could not be found
Run Code Online (Sandbox Code Playgroud)
怎么会发生这种情况?我以为pom.xml使用了项目的feature.xml,不是吗?什么是正确的配置?
到目前为止,您的配置看起来不错.但是,您目前只有自己的功能,而不是插件的自动构建.与Eclipse导出向导不同,eclipse-feature只处理feature.xml - 并且它期望引用的插件在其他地方构建.
所以你需要做的是建立一个包含eclipse-feature一个eclipse-plugin项目和一个项目的Maven反应堆.这是你如何做到这一点:
pom适应的内容artifactId(例如MyProject.parent),并将pom.xml移动到工作区中的新常规项目中.在功能项目的根目录中添加pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>MyProject</groupId>
<artifactId>MyProject.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>relative/path/to/parent/project</relativePath>
</parent>
<artifactId>NMGDBPluginFeature</artifactId>
<packaging>eclipse-feature</packaging>
</project>
Run Code Online (Sandbox Code Playgroud)在插件项目的根目录中添加另一个pom.xml,它与上面的那个相同,除了artifactId- 这需要与插件的相同Bundle-SymbolicName- 以及packaging需要的插件eclipse-plugin.
通过<modules>在父POM中添加包含这些项目的路径的部分,在Maven反应器中包含插件和要素项目:
<modules>
<module>relative/path/to/plugin/project</module>
<module>relative/path/to/feature/project</module>
</modules>
Run Code Online (Sandbox Code Playgroud)请注意,需要调整路径以使它们对于磁盘上的项目位置是正确的(这可能与Eclipse工作区中显示的不同).路径需要是相对的,所以它们可能从一开始../.
现在,您可以在父POM上触发Maven构建,该功能应该能够解析对插件的引用.在Eclipse中,您可以从pom.xml文件的上下文菜单中触发Maven构建.或者,如果您还将父项目转换为Maven项目,您还可以从项目根目录的上下文菜单中运行Maven构建.
| 归档时间: |
|
| 查看次数: |
481 次 |
| 最近记录: |