简体   繁体   中英

Build only necessary Eclipse RCP plugins for a plugin with Tycho

I'm new in Maven and Tycho and I hope that I'm not ask a silly question. Thanks for reading!!

I'm in a big Eclipse RCP Project with a structure like this:

-plugin 1

|-pom.xml

-plugin 2

|-pom.xml

-plugin 3

|-pom.xml

-plugin 4

|-pom.xml

-product 1

|-pom.xml

-product 2

|-pom.xml

-master

|-pom.xml

In my case the product 1 needs plugin 1 and plugin 2 to be built before and product 2 needs plugin 2, plugin 3 and plugin 4 to be built before.

The master pom.xml-file is the parent of all the plugin and product pom.xml-files. When I run mvn clean install on the master pom.xml, all products and plugins are built correctly.

When I run mvn clean install on the pom.xml file of product 1, it takes the built .jar-files of plugin 1 and plugin 2. (product 2 analog)

Here is my question. Is there any possibility to rebuild the necessary plugins for only one product without using already built .jar files and without building "too much" plugins?

In my case this would mean, that I want run mvn clean install on product 1 and it should build also plugin 1 and plugin 2 but not plugin 3-4 and not product 2.

If it helps you, here are sample pom.xml files of my project:

master 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>

All the other plugin and product definitions are analog.

Thank you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM