使用 Maven Tycho 构建的更新站点缺少插件和功能文件夹

Missing plugin and feature folders for an update site built with Maven Tycho

我正在使用 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

如您所见,pluginfeature 文件夹在 target/repository 中丢失。 这是我的 parent 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>

我做错了什么?

提前致谢。

UPDATE:正如 howlger 所要求的,这里是更新站点的 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

我按照书本 Eclipse 4 Plug-in Development by Example Beginners Guide by Dr Alex Blewitt 的说明进行操作,该书使用旧版本的 tycho (0.18.0),我使用的是 2.2.0。也许在这个版本中,他们修复了将站点重命名为类别的事实,因为在同一本书中他们提到这是一个毫无意义的更改。 我引用:

Rename the site.xml file to category.xml . (This is an entirely pointless change required by p2 since the files are identical in format.)

根据错误消息 (... 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: in category.xml the feature 是通过 ID com.vogella.tycho.feature 引用的。

com.vogella.tycho.feature