问题描述
我正在用 Tycho 构建一个 Eclipse 插件。我想为它创建一个更新站点。我有以下组件:
但是当我在更新站点项目的目标文件夹中运行 mvn clean package
时:
├── lorem-ipsum-eclipse-update-1.0.1-SNAPSHOT.zip
├── local-artifacts.properties
├── p2agent
│ ├── org.eclipse.equinox.p2.core
│ │ └── cache
│ │ └── artifacts.xml
│ └── org.eclipse.equinox.p2.engine
│ └── profileRegistry
├── p2artifacts.xml
├── p2content.xml
├── repository
│ ├── artifacts.jar
│ ├── artifacts.xml.xz
│ ├── content.jar
│ ├── content.xml.xz
│ └── p2.index
└── targetPlatformRepository
└── content.xml
如您所见,plugin
中缺少 feature
和 target/repository
文件夹。
这是我的父 pom:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.lorem.ipsum.eclipse</groupId>
<version>1.0.1-SNAPSHOT</version>
<artifactId>lorem-ipsum-eclipse-parent</artifactId>
<packaging>pom</packaging>
<properties>
<tycho-version>2.2.0</tycho-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>lorem-ipsum-eclipse-feature</module> <!-- packaging: eclipse-feature -->
<module>lorem-ipsum-eclipse-plugin</module> <!-- packaging: eclipse-plugin -->
<module>lorem-ipsum-eclipse-update</module> <!-- packaging: eclipse-repository -->
</modules>
<repositories>
<repository>
<id>2020-12</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/2020-12</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<includeAllDependencies>true</includeAllDependencies>
<createArtifactRepository>true</createArtifactRepository>
<compress>true</compress>
</configuration>
</plugin>
<!--Enable the replacement of the SNAPSHOT version in the final product configuration-->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<phase>package</phase>
<id>package-feature</id>
<configuration>
<finalName>${project.artifactId}_${unqualifiedVersion}.${buildQualifier}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我做错了什么?
提前致谢。
更新:这里要求更新站点的 category.xml。
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature id="com.lorem.ipsum.eclipse.feature" version="0.0.0">
<category name="com.lorem.ipsum.eclipse.category"/>
</feature>
<category-def name="com.lorem.ipsum.eclipse.category" label="Lorem Ipsum">
<description>
Contains features for Lorem Ipsum plugin
</description>
</category-def>
</site>
顺便说一下,我的文件命名为 site.xml
因为如果我命名为 category.xml
我在尝试运行任何 maven 目标时都会出现此错误:
$ mvn clean
...
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: lorem-ipsum-eclipse-update raw:1.0.1.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):1.0.1-SNAPSHOT
[ERROR] Missing requirement: lorem-ipsum-eclipse-update raw:1.0.1.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):1.0.1-SNAPSHOT requires 'org.eclipse.equinox.p2.iu; com.lorem.ipsum.eclipse.feature.feature.group 0.0.0' but it Could not be found
[ERROR]
[ERROR] See https://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[ERROR] Cannot resolve dependencies of MavenProject: com.globant.augmented.coding.eclipse:lorem-ipsum-eclipse-update:1.0.1-SNAPSHOT @ /home/me/workspaces/java/lorem-ipsum-eclipse-project/lorem-ipsum-eclipse-update/pom.xml: See log for details -> [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/MavenExecutionException
我按照使用旧版本 tycho (0.18.0) 的 Eclipse 4 Plug-in Development by Example Beginners Guide by Dr Alex Blewitt
一书的说明进行操作,我使用的是 2.2.0。也许在这个版本中他们修复了将站点重命名为类别的事实,因为在同一本书中他们提到这是一个毫无意义的更改。
我引用:
将 site.xml 文件重命名为 category.xml 。 (这是一个完全 p2 需要无意义的更改,因为文件在 格式。)
解决方法
根据错误消息 (... lorem-ipsum-eclipse-update ... Missing requirement: ... com.lorem.ipsum.eclipse.feature.feature.group ...
),更新站点 category.xml
引用了缺失的功能。
确保在以下两个文件中使用相同的功能 ID (<feature id="..."
):
<your-feature>/feature.xml
<your-update-site>/category.xml
另请参阅 vogella 教程 Eclipse Tycho for building Eclipse Plug-ins and RCP applications:在 category.xml
中,feature 通过 ID com.vogella.tycho.feature
引用。
com.vogella.tycho.feature