【问题标题】:tycho-p2-director-plugin deletes generated artifactstycho-p2-director-plugin 删除生成的工件
【发布时间】:2015-11-06 13:13:13
【问题描述】:

我正在尝试使用 tycho-p2-director-plugin 来实现产品,但该插件似乎删除了执行结束附近的工件。此外,调用的插件排列很奇怪:“tycho-p2-repository-plugin”->“tycho-packaging-plugin”->“maven-clean-plugin”->“tycho-p2-director-插入”。

以下是产品项目的pom.xml:

...
<packaging>eclipse-repository</packaging>

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-p2-director-plugin</artifactId>
            <version>0.24.0</version>
            <executions>
                <execution>
                    <id>materialize-products</id>
                    <goals>
                        <goal>materialize-products</goal>
                    </goals>
                </execution>
            </executions>
                <configuration>
                    <products>
                        <product>
                            <id>productSample</id>
                        </product>
                    </products>
                </configuration>
        </plugin>       
    </plugins>
</build>

以下是在产品项目上调用“mvn package”的输出:

[INFO] ------------------------------------------------------------------------
[INFO] Building com.product.project 1.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- tycho-packaging-plugin:0.24.0:build-qualifier-aggregator (default-build-qualifier-aggregator) @ com.product.project ---
[INFO] The project's OSGi version is 1.2.0.201511061039
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean-1) @ com.product.project ---
[INFO] Deleting C:\test\com.product.project\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ com.product.project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\test\com.product.project\src\main\resources
[INFO]
[INFO] --- target-platform-configuration:0.24.0:target-platform (default-target-platform) @ com.product.project ---
[INFO]
[INFO] --- tycho-p2-publisher-plugin:0.24.0:publish-products (default-publish-products) @ com.product.project ---
[INFO]
[INFO] --- tycho-p2-publisher-plugin:0.24.0:publish-categories (default-publish-categories) @ com.product.project ---
[INFO]
[INFO] --- tycho-p2-publisher-plugin:0.24.0:attach-artifacts (default-attach-artifacts) @ com.product.project ---
[INFO]
[INFO] --- tycho-p2-repository-plugin:0.24.0:assemble-repository (default-assemble-repository) @ com.product.project ---
[INFO]
[INFO] --- tycho-p2-repository-plugin:0.24.0:archive-repository (default-archive-repository) @ com.product.project ---
[INFO] Building zip: C:\test\com.product.project\target\com.product.project-1.2.0-SNAPSHOT.zip
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) > generate-sources @ com.product.project >>>
[INFO]
[INFO] --- tycho-packaging-plugin:0.24.0:build-qualifier-aggregator (default-build-qualifier-aggregator) @ com.product.project ---
[INFO] The project's OSGi version is 1.2.0.201511061039
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean-1) @ com.product.project ---
[INFO] Deleting C:\test\com.product.project\target
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) < generate-sources @ com.product.project <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) @ com.product.project ---
[INFO] No sources in project. Archive not created.
[INFO]
[INFO] --- tycho-p2-director-plugin:0.24.0:materialize-products (materialize-products) @ com.product.project ---
[INFO] Installing product productSample for environment win32/win32/x86 to C:\test\com.product.project\target\products\productSample\win32\win32\x86
Installation failed.
The installable unit productSample has not been found.
Application failed, log file location: C:\test\workspace\.metadata\.log

很明显 tycho-p2-director-plugin 找不到任何文件,因为 maven-clean-plugin 在 tycho-packaging-plugin 之后被调用了!任何想法为什么会发生这种情况?

【问题讨论】:

    标签: eclipse maven plugins tycho


    【解决方案1】:

    在eclipse-repository的默认生命周期[1]中有一个maven clean插件, 但它默认映射到生命周期阶段“初始化”。

    构建日志中 ID 为“default-clean-1”的干净调用对我来说似乎很奇怪。

    这可能是由分叉的 Maven 生命周期引起的。 maven-source-plugin 可能对此负责(至少在构建 eclipse-repository 打包类型时我不会期望执行 maven-source-plugin)

    看起来 [2] 是相关的。尝试删除 maven-source-plugin 或者如果您确实需要它,请尝试使用它的 jar-no-fork 目标。

    [1]https://dev.eclipse.org/mhonarc/lists/tycho-user/msg03724.html

    [2]Difference between Maven source plugin jar and jar-no-fork goal?

    【讨论】:

    • 谢谢@jsievers,您的两个建议都对我有用。首先,我从父 pom 中删除了 maven-source-plugin 并开始工作。之后因为需要在其他地方使用,所以我只是覆盖了产品项目的 pom.xml 中的 maven-source-plugin:
    • org.apache.maven.pluginsmaven-source-pluginattach-sourcesverifyjar-no-fork
    • 哇,如果没有你的回答,我不知道我是否能解决这个问题,谢谢!
    • 另一种可能的解决方案是通过引用 id(在本例中为“attach-sources”)将 maven-source 插件绑定到任何阶段。提供的示例 xml:&lt;plugin&gt;&lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;&lt;executions&gt;&lt;execution&gt;&lt;id&gt;attach-sources&lt;/id&gt;&lt;phase/&gt;&lt;/execution&gt;&lt;/executions&gt;&lt;/plugin&gt;
    猜你喜欢
    • 1970-01-01
    • 2012-01-24
    • 2018-08-14
    • 2011-03-08
    • 2016-05-22
    • 2019-01-02
    • 1970-01-01
    • 2012-04-30
    • 1970-01-01
    相关资源
    最近更新 更多