You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Eclipse插件构建中从p2仓库排除指定Jar包

排除P2仓库中的指定Jar包/Feature

情况1:该Jar包是传递依赖引入(常规Maven项目)

如果com.*.editors.text_*.jar是作为某个核心依赖的传递依赖被引入的,直接在对应依赖节点下添加排除规则:

<dependency>
    <groupId>你的依赖实际groupId</groupId>
    <artifactId>你的依赖实际artifactId</artifactId>
    <version>对应版本号</version>
    <exclusions>
        <exclusion>
            <!-- 替换为实际的groupId,比如com.example.editors -->
            <groupId>com.example.editors</groupId>
            <artifactId>editors.text</artifactId>
        </exclusion>
    </exclusions>
</dependency>

情况2:基于Tycho的P2构建项目

因为你配置的是P2仓库,大概率是Eclipse Tycho项目,可通过以下方式排除:

排除指定Bundle

在pom.xml的dependencyManagement中声明该Bundle为provided或直接排除:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.example.editors</groupId>
            <artifactId>com.example.editors.text</artifactId>
            <version>0.0.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

或者在tycho-p2-repository-plugin中添加过滤规则:

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-p2-repository-plugin</artifactId>
    <version>${tycho.version}</version>
    <configuration>
        <filters>
            <filter>
                <type>bundle</type>
                <!-- 匹配目标Bundle的ID -->
                <id>com.*.editors.text</id>
                <remove>true</remove>
            </filter>
        </filters>
    </configuration>
</plugin>

排除对应Feature

如果知道该Jar所属Feature的ID,可在tycho-p2-director-plugin中配置排除:

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-p2-director-plugin</artifactId>
    <version>${tycho.version}</version>
    <configuration>
        <excludedFeatures>
            <!-- 替换为实际Feature ID -->
            <feature>com.example.editors.text.feature</feature>
        </excludedFeatures>
    </configuration>
</plugin>

注意:所有占位符(如com.example.editors、版本号等)需替换为项目实际的对应值。

内容的提问来源于stack exchange,提问作者Birudeo Garande

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 08:50:05