无法打包插件

Unable to package plugin

我创建了一个 eclipse 插件,包含以下清单文件:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Commitlinking
Bundle-SymbolicName: com.polarion.commitlinking;singleton:=true
Bundle-Version: 1.0.0.202101092309
Bundle-ClassPath: com.polarion.commitlinking_1.0.0.202101092309.jar
Bundle-Activator: com.polarion.commitlinking.Activator
Bundle-Vendor: POLARION
Require-Bundle: javax.inject,
 org.eclipse.osgi,
 org.eclipse.jface,
 org.eclipse.e4.ui.model.workbench,
 org.eclipse.e4.ui.di,
 org.eclipse.e4.ui.services,
 org.eclipse.e4.core.di.annotations,
 org.eclipse.core.runtime,
 org.eclipse.e4.core.di,
 org.eclipse.e4.core.contexts;bundle-version="1.8.400",
 org.eclipse.e4.ui.workbench,
 org.eclipse.core.commands,
 org.eclipse.ui.workbench,
 org.eclipse.ui,
 com.polarion.alm.ws.client
Bundle-RequiredExecutionEnvironment: JavaSE-15
Bundle-ActivationPolicy: lazy
Import-Package: javax.annotation;version="1.2.0",
 javax.inject;version="1.0.0",
 org.eclipse.core.expressions,
 org.eclipse.core.runtime;version="3.5.0",
 org.eclipse.e4.core.commands,
 org.eclipse.e4.core.di.extensions;version="0.16.0",
 org.eclipse.e4.core.services.events,
 org.eclipse.e4.ui.dialogs,
 org.eclipse.e4.ui.workbench.modeling,
 org.eclipse.jface.text,
 org.eclipse.ui,
 org.eclipse.ui.commands,
 org.eclipse.ui.menus,
 org.eclipse.ui.plugin,
 org.osgi.service.event;version="1.4.0"
Automatic-Module-Name: com.polarion.commitlinking

不幸的是,包括相关的罐子作为外部罐子不允许我成功创建插件所以我尝试(按照 vogella 上的建议)导出目标平台并创建一个父 pom 并在其中放置我的插件项目和另一个使用目标平台管理依赖项的项目: 父 pom:

<?xml version="1.0" encoding="UTF-8"?>
<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>com.packtpub.e4</groupId>
<artifactId>com.packtpub.e4.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
    <tycho.version>2.1.0</tycho.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <eclipse-repo.url>http://download.eclipse.org/releases/latest</eclipse-repo.url>
</properties>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-director-plugin</artifactId>
                <version>${tycho.version}</version>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>${tycho.version}</version>
            <extensions>true</extensions>
        </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>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>target-platform-configuration</artifactId>
            <version>${tycho.version}</version>
            <configuration>
                <target>
                    <artifact>
                        <groupId>com.vogella.tycho</groupId>
                        <artifactId>target-platform</artifactId>
                        <version>1.0.0-SNAPSHOT</version>
                    </artifact>
                </target>
                <environments>
                    <environment>
                        <os>linux</os>
                        <ws>gtk</ws>
                        <arch>x86_64</arch>
                    </environment>
                    <environment>
                        <os>win32</os>
                        <ws>win32</ws>
                        <arch>x86_64</arch>
                    </environment>
                    <environment>
                        <os>macosx</os>
                        <ws>cocoa</ws>
                        <arch>x86_64</arch>
                    </environment>
                </environments>
            </configuration>
        </plugin>
    </plugins>
</build>
<modules>
      <module>target-platform</module>
      <module>com.polarion.commitlinking</module>
</modules>

目标平台项目:

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.packtpub.e4</groupId>
        <artifactId>com.packtpub.e4.parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <groupId>com.vogella.tycho</groupId>
    <artifactId>target-platform</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>eclipse-target-definition</packaging>
    <name>target-platform</name>
</project>

插件pom如下:

<?xml version="1.0" encoding="UTF-8"?>
<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>com.polarion</groupId>
    <artifactId>com.polarion.commitlinking</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>eclipse-plugin</packaging>
    <parent>
        <groupId>com.packtpub.e4</groupId>
        <artifactId>com.packtpub.e4.parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
</project>

目标-platform.target文件如下:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="Polarion plugin development">
    <locations>
        <location path="/home/bilal/eclipse/java-2020-092/eclipse/" type="Profile"/>
        <location path="/opt/polarion/polarion/" type="Directory"/>
        <location path="/home/bilal/Programs/eclipse-installer/plugins/" type="Directory"/>
    </locations>
    <environment>
        <arch>x86_64</arch>
        <os>linux</os>
        <ws>gtk</ws>
        <nl>en_US</nl>
    </environment>
    <launcherArgs>
        <vmArgs>-Declipse.p2.max.threads=10 -Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest -Doomph.redirection.index.redirection=index:/-&gt;http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/ -Dosgi.requiredJavaVersion=11 -Dosgi.instance.area.default=@user.home/eclipse-workspace -Dsun.java.command=Eclipse -XX:+UseG1GC -XX:+UseStringDeduplication --add-modules=ALL-SYSTEM -Dosgi.requiredJavaVersion=11 -Dosgi.dataAreaRequiresExplicitInit=true -Xms256m -Xmx2048m --add-modules=ALL-SYSTEM</vmArgs>
    </launcherArgs>
    <includeBundles>
        <plugin id="ch.qos.logback.classic"/>
         .....

但是,当我 运行 mvn clean package 我得到以下异常:

Internal error: org.eclipse.tycho.repository.local.MirroringArtifactProvider$MirroringFailedException: Could not mirror artifact osgi.bundle,org.apache.log4j,1.2.17.2019-11-22 into the local Maven repository.See log output for details. /opt/polarion/polarion/plugins/org.apache.log4j_1.2.17.2019-11-22 (Is a directory)

这是因为依赖项之一,即 org.apache.log4j_1.2.17.2019-11-22 实际上是一个 ddirectory,里面有一个 log4j-lib 插件。当 运行 在 IDE 中设置项目时,这很好用,但我不知道如何正确解决这个问题。任何帮助将不胜感激!

所以实际的解决方案是使用现有的 jar 存档选项创建一个新插件。将该插件作为依赖项添加到我的插件中,并将其添加到模块部分的 parent pom.xml 中。需要对依赖项进行一些修改,但将生成的构建 jar 文件添加到 dropins 文件夹目前似乎已经奏效了。