第谷:我如何部署可选的源罐子?

Tycho: How do I deploy sources jars optional?

基于 this 我使用此代码来发布我的项目的源代码。

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-source-plugin</artifactId>
    <version>${tycho.version}</version>
    <executions>
        <execution>
            <id>plugin-source</id>
            <goals>
                <goal>plugin-source</goal>
            </goals>
        </execution>
    </executions>
</plugin>

到目前为止一切正常。我有一个 xxxx.jar 和一个 xxxx.source.jar

但是如果我想发布可选的源代码怎么办?

有没有办法可以只按需发送源代码?就像普通用户在没有源代码的情况下获得它而其他开发人员获得它一样?

编辑

在查看了 tycho-soure-feature-plugin 之后,这就是我得到的结果:

[ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-source-feature-plugin:1.0.0:source-feature (source-feature) on project projectname.feature: Execution source-feature of goal org.eclipse.tycho.extras:tycho-source-feature-plugin:1.0.0:source-feature failed: An API incompatibility was encountered while executing org.eclipse.tycho.extras:tycho-source-feature-plugin:1.0.0:source-feature: java.lang.UnsupportedClassVersionError: org/eclipse/tycho/packaging/LicenseFeatureHelper : Unsupported major.minor version 52.0

所以我查找了为什么会出现错误 -> 我使用 JDK 1.6 并且在构建服务器上没有安装其他 JDK 所以我不能使用这个插件即使我会使用Maven 工具链

Room

这是我会做的(也是我认为的最佳做法):始终 构建 eclipse-plugin.source.jarbut 提供两种 eclipse-features:一种包含源代码(由开发人员安装),另一种不包含(由普通用户安装)。您可以为此使用 tycho-source-feature-plugin

首先,我想说 Andreas Sewe 的回答是正确的,我将其标记为已接受,因为如果您使用 JDK 1.7,这是最好的解决方案。

对于我的问题(只有 JDK 1.6 可用)我通过创建一个名为 xxxx.source

的新项目的方式解决了它

这样我就有了一个单独的 xxxx.source.jar