【问题标题】:Tycho puts "p2" folder in the product with eclipse-repository and tycho-p2-director-plugin pluginsTycho 使用 eclipse-repository 和 tycho-p2-director-plugin 插件将“p2”文件夹放入产品中
【发布时间】:2012-01-24 21:42:09
【问题描述】:

我将我的 Tycho+Maven 构建(RCP 应用程序)更改为使用 Tycho 0.13 和 eclipse-repository 加上 tycho-p2-director-plugin(而不是我在 Tycho 0.10 中的旧“eclipse-application”)。 我设法让构建工作(生成 ZIP 文件),但它们比以前大 2 倍。 我看到第谷放了很多我的产品不需要的额外东西: 1) 根级别的“p2”文件夹 - 35 Mb。 2)很多无用的插件,比如

plugins/org.eclipse.jdt.debug_3.6.1.v20100715_r361
plugins/org.eclipse.pde.build_3.6.2.R36x_20110203
plugins/org.junit_4.8.1.v4_8_1_v20100427-1100
......etc.........

如何配置“eclipse-repository”和“tycho-p2-director-plugin”来避免这种情况?至少不要将“p2”文件夹放在产品中。我的软件不使用“p2 update”机制进行自动更新。

【问题讨论】:

    标签: eclipse eclipse-rcp maven-3 tycho


    【解决方案1】:

    您的产品可能会引入可传递的可选依赖项。

    请参阅 [1] 了解如何避免这种情况。

    始终会创建 p2/ 文件夹,但不应为 35MB。 如果您可以提供一个示例项目来重现该问题,请打开一个错误 [2] 并将其与如何重现的步骤一起附加。

    [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=342704

    [2]https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Tycho&rep_platform=All&op_sys=All

    【讨论】:

    • 谢谢,我会尝试删除可选的依赖项,虽然很遗憾从 eclipse-application 切换到这个新方法引入了这个问题。也许我可以用“import-package”替换“require-bundle”,它会解决问题......我们拭目以待。准确地说,p2 文件夹有 30.5 Mb。这个构建现在相当复杂,我不知道如何用一个简单的项目来重现它。如果您愿意调试此 Tycho 问题,我可以将构建脚本直接发送给您。
    【解决方案2】:

    我最终完全删除了“存档产品”——它不灵活,需要进行大量可怕的拆包/重新打包/重命名。我现在自己打包 ZIP 文件:

    <properties>
       <distributive.prefix>${project.build.directory}/products/taskadapter</distributive.prefix>
       <exclude_p2>**/p2/**</exclude_p2>
    </properties>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-director-plugin</artifactId>
                <version>${tycho.version}</version>
                <executions>
                    <execution>
                        <id>materialize-products</id>
                        <goals>
                            <goal>materialize-products</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
    
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>create-zip-files</id>
                        <phase>package</phase>
                        <configuration>
                            <target> 
                                <zip basedir="${distributive.prefix}/win32/win32/x86" 
                                     destfile="${project.build.directory}/taskadapter-win-${project.version}.zip"
                                     excludes="${exclude_p2}" />
                                <zip basedir="${distributive.prefix}/linux/gtk/x86" 
                                     destfile="${project.build.directory}/taskadapter-linuxgtk-${project.version}.zip"
                                     excludes="${exclude_p2}" />
                                <zip basedir="${distributive.prefix}/macosx/cocoa/x86" 
                                     destfile="${project.build.directory}/taskadapter-macos-${project.version}.zip"
                                     excludes="${exclude_p2}" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

    【讨论】:

      【解决方案3】:
      1. “p2”文件夹,该文件夹是p2在物化产品时自己创建的。如果您的应用程序本身不支持更新,您只需将其从构建的产品中删除即可。
      2. 无用的插件。没有办法从您的最终物化产品中删除它们,它们是您的产品传递性需要的。详情请见this

      【讨论】:

      • 那么,有没有办法告诉 Tycho 不要将 P2 文件夹放入产品中?如果不是(难过!),那么在包装前去除它的最佳方法是什么?
      • 答案是否定的。 P2 director 总是创建 p2 文件夹来存储一些数据,比如已经安装了哪些功能/插件。
      • @Alex,您可以添加 ant 任务以解压缩 zip,然后在排除 p2 文件夹的同时创建新的。
      • 我可以在打包成ZIP文件之前删除无用的p2文件夹以避免这个奇怪的步骤吗?..
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-02
      • 2011-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-14
      相关资源
      最近更新 更多