Сбой сборки Maven: невозможно разрешить зависимости приложения продукта. - PullRequest
0 голосов
/ 18 февраля 2019

Я обновил свое приложение RCP e4 с Java8 до Java11.После проблем со сборкой PDE я переключаюсь на Maven.

Я создаю проект сборки maven (APPPARENT):

<project xmlns="...">
    <modelVersion>4.0.0</modelVersion>
    <groupId>application.build</groupId>
    <artifactId>APPPARENT</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <tycho-version>1.3.0</tycho-version>
        <eclipse-repo.url>http://download.eclipse.org/releases/2018-12</eclipse-repo.url>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.eclipse.equinox</groupId>
            <artifactId>org.eclipse.equinox.common</artifactId>
            <version>3.6.0</version>
        </dependency>
        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.23.1-GA</version>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>3.2.7</version>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.4.0-b180725.0427</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>2.4.0-b180725.0644</version>
        </dependency>       
    </dependencies>

    <repositories>
        <!-- Select the P2 repository to be used when resolving dependencies -->
        <repository>
            <id>eclipse-release</id>
            <url>${eclipse-repo.url}</url>
            <layout>p2</layout>
        </repository>
        <repository>
            <id>tycho-maven</id>
            <url>file://C:\agent\.m2\repository</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>              
            <plugin>
                <!-- enable tycho build extension -->
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho-version}</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <id>package-feature</id>
                        <configuration>
                            <finalName>${project.artifactId}_${unqualifiedVersion}.${buildQualifier}</finalName>
                        </configuration>
                    </execution>
                </executions>
                <!-- <extensions>true</extensions>-->
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho-version}</version>
                <configuration>
                    <environments>
                        <environment>
                            <os>win32</os>
                            <ws>win32</ws>
                            <arch>x86_64</arch>
                        </environment>
                    </environments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
                <configuration>
                    <argLine>
                        --illegal-access=permit
                    </argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.0</version>
                <configuration>
                    <argLine>
                        --illegal-access=permit
                    </argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

     <modules>
        <module>../application.model</module>
        <module>../application.rcp</module>
        <module>../application.service</module>
        <module>../rcp.ui.common</module>
    </modules>
</project>

Я определяю плагин, который содержит продукт, как репозиторий затмений:

<project xmlns="...">
  <modelVersion>4.0.0</modelVersion>
  <groupId>application.rcp</groupId>
  <artifactId>application.rcp</artifactId>
  <name>Application</name>
  <version>1.4.0-SNAPSHOT</version>
  <packaging>eclipse-repository</packaging>
  <parent>
    <groupId>application.build</groupId>
    <artifactId>APPPARENT</artifactId>
    <version>1.0.0</version>
    <relativePath>../application.build/pom.xml</relativePath>
  </parent>
  <build>
   <plugins>
      <plugin>
         <groupId>org.eclipse.tycho</groupId>
         <artifactId>tycho-p2-director-plugin</artifactId>
         <version>${tycho-version}</version>
         <executions>
            <execution>
               <id>create-product-distributions</id>
               <goals>
                  <goal>materialize-products</goal>
                  <goal>archive-products</goal>
               </goals>
            </execution>
         </executions>
      </plugin>
   </plugins>
</build>
</project>

все остальные плагины определены как eclipse-plugin:

<project xmlns="...">
  <modelVersion>4.0.0</modelVersion>
  <groupId>application.model</groupId>
  <artifactId>application.model</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>eclipse-plugin</packaging>
  <parent>
    <groupId>application.build</groupId>
    <artifactId>APPPARENT</artifactId>
    <version>1.0.0</version>
    <relativePath>../application.build/pom.xml</relativePath>
  </parent>
  <build>
  <plugins>
    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-maven-plugin</artifactId>
      <version>${tycho-version}</version>
      <extensions>true</extensions>
    </plugin>
  </plugins>
</build>
</project>

Команда "mvn clean test-compile compile" работает нормально.Сборка не удалась, если я попытался запустить команду "mvn clean verify", "mvn clean install" или "mvn install".К сожалению, я не могу найти решение этой проблемы.

[INFO] Reactor Summary:
[INFO] 
[INFO] APPPARENT 1.0.0 .................................... SUCCESS [  0.104 s]
[INFO] application.model 1.0.0-SNAPSHOT ................... SUCCESS [  2.500 s]
[INFO] rcp.ui.common 1.0.0-SNAPSHOT ....................... SUCCESS [  4.759 s]
[INFO] application.service 1.0.0-SNAPSHOT ................. SUCCESS [  1.041 s]
[INFO] Application 1.4.0-SNAPSHOT ......................... FAILURE [  1.811 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  28.285 s
[INFO] Finished at: 2019-02-18T15:43:00+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-publisher-plugin:1.3.0:publish-products (default-publish-products) on project application.rcp: Execution default-publish-products of goal org.e
clipse.tycho:tycho-p2-publisher-plugin:1.3.0:publish-products failed: Cannot resolve dependencies of product application.product. See log for details. -> [Help 1]
...