簡體   English   中英

使用Tycho為插件構建僅必要的Eclipse RCP插件

[英]Build only necessary Eclipse RCP plugins for a plugin with Tycho

我是Maven和Tycho的新手,我希望我不要問一個愚蠢的問題。 謝謝閱讀!!

我在一個大型Eclipse RCP項目中,其結構如下:

插件1

| -pom.xml

插件2

| -pom.xml

插件3

| -pom.xml

插件4

| -pom.xml

產品1

| -pom.xml

產品2

| -pom.xml

-主

| -pom.xml

在我的情況下,產品1需要先構建插件1和插件2,產品2需要先構建插件2,插件3和插件4。

主pom.xml文件是所有插件和產品pom.xml文件的父文件。 當我在主pom.xml上運行mvn clean install時,所有產品和插件均正確構建。

當我在產品1的pom.xml文件上運行mvn clean install時,它將采用插件1和插件2的內置.jar文件。(產品2類似物)

這是我的問題。 是否有可能只為一種產品重建必需的插件,而無需使用已構建的.jar文件,也無需構建“太多”的插件?

就我而言,這意味着我要在產品1上運行mvn clean install ,它還應該構建插件1和插件2,但不能構建插件3-4,而不是產品2。

如果有幫助,這里是我項目的示例pom.xml文件:

主pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>

    <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>
<groupId>myGroupId</groupId>
<artifactId>master</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
    <tycho.version>0.17.0</tycho.version>
</properties>

<modules>
    <module>../plugin1</module>
    <module>../plugin2</module>
    <module>../plugin3</module>
    <module>../plugin4</module>
    <module>../product1</module>
    <module>../product2</module>
</modules>



<repositories>
    <!-- configure p2 repository to resolve against -->
    <repository>
        <id>Repository1</id>
        <layout>p2</layout>
        <url>url-to-a-p2-site-on-my-server</url>
    </repository>
</repositories>

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>${tycho.version}</version>
            <extensions>true</extensions>
        </plugin>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>target-platform-configuration</artifactId>
            <version>${tycho.version}</version>
            <configuration>
                <resolver>p2</resolver>
                <pomDependencies>consider</pomDependencies>
                <target>
                    <artifact>
                        <groupId>myGroupId</groupId>
                        <artifactId>myGroupId.target</artifactId>
                        <classifier>targetPlatform</classifier>
                    </artifact>
                </target>
                <environments>
                    <environment>
                        <os>macosx</os>
                        <ws>cocoa</ws>
                        <arch>x86_64</arch>
                    </environment>
                    <environment>
                        <os>linux</os>
                        <ws>gtk</ws>
                        <arch>x86</arch>
                    </environment>
                    <environment>
                        <os>linux</os>
                        <ws>gtk</ws>
                        <arch>x86_64</arch>
                    </environment>
                    <environment>
                        <os>win32</os>
                        <ws>win32</ws>
                        <arch>x86</arch>
                    </environment>
                    <environment>
                        <os>win32</os>
                        <ws>win32</ws>
                        <arch>x86_64</arch>
                    </environment>
                </environments>
                <ignoreTychoRepositories>false</ignoreTychoRepositories>
            </configuration>
        </plugin>
    </plugins>
</build>
    </project>

plugin1 pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
    <artifactId>master</artifactId>
    <groupId>myGroupId</groupId>
    <version>0.0.1-SNAPSHOT</version>
    <relativePath>../master/pom.xml</relativePath>
</parent>

<groupId>myGroupId</groupId>
<artifactId>plugin1</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>

product1 pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
    <artifactId>master</artifactId>
    <groupId>myGroupId</groupId>
    <version>0.0.1-SNAPSHOT</version>
    <relativePath>../master/pom.xml</relativePath>
</parent>

<groupId>myGroupId</groupId>
<artifactId>product1</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>

<name>product 1 build</name>
<build>
    <plugins>

        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-p2-director-plugin</artifactId>
            <version>${tycho.version}</version>
            <configuration>
                <publishArtifacts>true</publishArtifacts>
            </configuration>
            <executions>
                <execution>
                    <id>materialize-products</id>
                    <goals>
                        <goal>materialize-products</goal>
                    </goals>
                </execution>
            </executions>

        </plugin>
    </plugins>
</build>
    </project>

所有其他插件和產品定義都是模擬的。

謝謝!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM