IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Maven Java Discussion :

Intégration des dépendances avec le plugin Maven Tycho


Sujet :

Maven Java

  1. #1
    Membre régulier
    Inscrit en
    Juillet 2003
    Messages
    139
    Détails du profil
    Informations forums :
    Inscription : Juillet 2003
    Messages : 139
    Points : 86
    Points
    86
    Par défaut Intégration des dépendances avec le plugin Maven Tycho
    Bonjour,

    Après avoir construit un client Eclipse RCP vierge avec Maven via Tycho (en suivant le Tuto de Mickaël Baron), j'essaye maintenant de faire la même chose sur un projet existant et bien plus complexe.

    Mon problème se situe au niveau des dépendances qui ne sont pas visibles lors de la construction.

    Actuellement, le projet est décomposé comme ceci :

    • Projet client-rcp : contient tous les composants (wizard, page, editeur, ...)
    • Projet client-feature : pour la construction du product
    • Projet lib-plugin : contient toutes les librairies externes du projet
    • Une trentaine de projets Maven qui représente le métier de l'application (chaque partie est découper en 3 projets --> api, impl et test)


    Sur tous les projet Maven API, on a rajouter un MANIFEST.MF afin de pouvoir les inclure en tans que dépendance dans le client via le fichier plugin.xml.

    Je voudrais maintenant reprendre les mécanismes expliqués dans le tutoriel afin de gérer la construction du client via Maven. J'ai donc créé l'arborescence suivante :
    • client-aggregator
      • client-parent
      • client-feature
      • client-plugin
      • client-rcp


    le pom.xml de mon client parent est comme ceci :

    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     
    	<modelVersion>4.0.0</modelVersion>
     
    	<groupId>x.y.z</groupId>
      	<artifactId>client-parent</artifactId>
    	<version>11.0.0-SNAPSHOT</version>
      	<packaging>pom</packaging>
     
    	<properties>
    	  <tycho-version>0.23.0</tycho-version>
    	</properties>
     
     	<repositories>
     	  <repository>
    	    <id>lh</id>
    	    <layout>p2</layout>
    	    <url>file:///C:/Java/Eclipse/target-platform-3.8.2</url>
    	  </repository>
    	</repositories>
     
    	<build>
    	  <plugins>
    	    <plugin>
    	      <groupId>org.eclipse.tycho</groupId>
    	      <artifactId>tycho-maven-plugin</artifactId>
    	      <version>${tycho-version}</version>
    	    </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</arch>
    		  </environment>
    	        </environments>
    	      </configuration>
    	    </plugin>
    	  </plugins>
            </build>
    </project>

    A ce stade, dans le client j'ai commenté tout le code qui fait appel au métier afin de ne pas avoir d'erreur de compilation, je lance la commande mvn clean install depuis mon projet aggregator et tout se passe bien.
    Ensuite je décommente une partie du code qui fait appel à des objets déclarés dans un de mes projet API (on dira projetA-api).

    Dans un premier temps, j'ai donc ajouter dans client-rcp/plugin.xml la dépendance x.y.z.projetA-api (11.0.0) pour résoudre les erreurs de compilation, mais quand je relance le clean install, j'ai l'erreur suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    C:\Java\Workspaces\xxx\client-aggregator>mvn clean install
    [INFO] Scanning for projects...
    [INFO] Computing target platform for MavenProject:x.y.z:client-rcp:11.0.0-SNAPSHOT @ C:\Java\Workspaces\xxx\client-aggregator\client-rcp\pom.xml
    [INFO] Adding repository file:/C:/Java/Eclipse/target-platform-3.8.2
    [INFO] Resolving dependencies of MavenProject: x.y.z:client-rcp:11.0.0-SNAPSHOT @ C:\Java\Workspaces\xxx\client-aggregator\client-rcp\pom.xml
    [INFO] {osgi.ws=win32, osgi.os=win32, osgi.arch=x86, org.eclipse.update.install.features=true}
    [ERROR] Cannot resolve project dependencies:
    [ERROR]   Software being installed: client-rcp 11.0.0.qualifier
    [ERROR]   Missing requirement: client-rcp 11.0.0.qualifier requires 'bundle x.y.z.projetA-api 11.0.0' but it could not be found
    [ERROR]
    [ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
    [ERROR] Cannot resolve dependencies of MavenProject: x.y.z:client-rcp:11.0.0-SNAPSHOT @ C:\Java\Workspaces\xxx\client-aggregator\client-rcp\pom.xml: See log for details -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
    Après plusieurs recherches je suis tombé sur ce plugin plutôt séduisant. J'ai donc ajouter un projet client-repo-p2 avec le pom suivant :
    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     
      <modelVersion>4.0.0</modelVersion>
      <groupId>x.y.z</groupId>
      <artifactId>client-repo-p2</artifactId>
      <version>11.0.0-SNAPSHOT</version>
      <packaging>pom</packaging>
     
      <build>
        <plugins>
          <plugin>
            <groupId>org.reficio</groupId>
            <artifactId>p2-maven-plugin</artifactId>
            <version>1.2.0-SNAPSHOT</version>
            <executions>
              <execution>
                <id>default-cli</id>
                  <configuration>
                    <artifacts>
                      <!-- specify your depencies here -->
                      <artifact><id>x.y.z:projetA-api:11.0.0-SNAPSHOT</id></artifact>
                    </artifacts>
                  </configuration>
                </execution>
              </executions>
            </plugin>
    	<plugin>
    	  <groupId>org.eclipse.jetty</groupId>
    	  <artifactId>jetty-maven-plugin</artifactId>
    	  <version>9.2.6.v20141205</version>
    	  <configuration>
    	    <scanIntervalSeconds>10</scanIntervalSeconds>
    	    <webAppSourceDirectory>${basedir}/target/repository/</webAppSourceDirectory>
    	    <webApp>
    	      <contextPath>/site</contextPath>
    	    </webApp>
    	  </configuration>
    	  <dependencies>
    	    <dependency>
    	      <groupId>ch.qos.logback</groupId>
    	      <artifactId>logback-classic</artifactId>
    	      <version>0.9.29</version>
    	    </dependency>
    	  </dependencies>
    	</plugin>
          </plugins>
        </build>
     
        <pluginRepositories>
          <pluginRepository>
            <id>reficio</id>
            <url>http://repo.reficio.org/maven/</url>
          </pluginRepository>
        </pluginRepositories>
    </project>

    la commande mvn p2:site me construtit bien l'arborescence suivante dans target/repository :
    • plugins/x.y.z.projetA-api_11.0.0-SNAPSHOT.jar
    • artifacts.jar
    • category.xml
    • content.jar


    la commande mvn jetty:run expose bien cette arborescence via un serveur http a l'adresse http://localhost:8080/site.

    A partir de là je je créé un nouveau projet target definition auquel j'ajoute un fichier definition.target qui contient le site http://localhost:8080/site avec le plugin x.y.z.projetA-api.

    pom.xml
    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     
      <modelVersion>4.0.0</modelVersion>
     
      <parent>
        <groupId>x.y.z</groupId>
        <artifactId>client-parent</artifactId>
        <version>11.0.0-SNAPSHOT</version>
        <relativePath>../client-parent/pom.xml</relativePath>
      </parent>
     
      <artifactId>target-definition</artifactId>
      <packaging>eclipse-target-definition</packaging>
     
    </project>

    je modifie le pom de mon projet parent et j'ajoute la target definition
    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     
      <modelVersion>4.0.0</modelVersion>
     
      <groupId>x.y.z</groupId>
      <artifactId>client-parent</artifactId>
      <version>11.0.0-SNAPSHOT</version>
      <packaging>pom</packaging>
     
      <properties>
        <tycho-version>0.23.0</tycho-version>
      </properties>
     
      <repositories>
        <repository>
          <id>lh</id>
          <layout>p2</layout>
          <url>file:///C:/Java/Eclipse/target-platform-3.8.2</url>
        </repository>
      </repositories>
     
      <build>
        <plugins>
          <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>${tycho-version}</version>
          </plugin>
          <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>target-platform-configuration</artifactId>
            <version>${tycho-version}</version>
            <configuration>
              <target>
                <artifact>
                  <groupId>x.y.z</groupId>
                  <artifactId>target-definition</artifactId>
                  <version>11.0.0-SNAPSHOT</version>
                </artifact>
              </target>
              <environments>
                <environment>
                  <os>win32</os>
                  <ws>win32</ws>
                  <arch>x86</arch>
                </environment>
              </environments>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </project>

    Quand je relance la commande mvn clean install depuis mon projet aggregator j'ai l'erreur suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    C:\Java\Workspaces\xxx\client-aggregator>mvn clean install
    [INFO] Scanning for projects...
    [INFO] Computing target platform for MavenProject: x.y.z:client-rcp:11.0.0-SNAPSHOT @ C:\Java\Workspaces\xxx\client-aggregator\client-rcp\pom.xml
    [INFO] Adding repository http://localhost:8080/site
    [ERROR] Failed to resolve target definition C:\Java\Workspaces\xxx\client-aggregator\target-definition\target-definition.target: Failed to load p2 metadata repository from location http://localhost:8080/site: No repository found at http://localhost:8080/site. -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
    Je suis bloqué là pour l'instant, je ne comprends pas pourquoi il ne reconnait pas le repository.

    Si quelqu'un à une idée pour résoudre ce problème ou avoir une autre piste afin d'integrer mes dépendances à la construction de mon client, je ne dis pas non.... je bloque depuis une semaine sur ce problème, beaucoup de recherches sur le net retombe sur cette solution mais qui ne marche pas pour l'instant.

  2. #2
    Membre éprouvé

    Homme Profil pro
    Architecte technique
    Inscrit en
    Juin 2005
    Messages
    588
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Architecte technique
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Juin 2005
    Messages : 588
    Points : 1 230
    Points
    1 230
    Par défaut
    Cool en effet p2-maven-plugin

    Concernant ta 'target definition' je ne vois rien d'erroné dans ton pom... il faut chercher dans la construction de ton projet ou dans dans l'activation de celui-ci !

    Les metadata p2 ont elles bien été crées ?

    a+
    Philippe

    Je suppose que ton instance jetty est bien lancé ? même si la trace dit bien qu'elle accède à ton instance jetty, n'y aurait-il pas un conflit avec <url>file:///C:/Java/Eclipse/target-platform-3.8.2</url> dont tu ne devrais pas avoir besoin !

    Tu devrais aussi pouvoir visualiser ton dépot avec l'applet p2browser

Discussions similaires

  1. Réponses: 0
    Dernier message: 24/07/2009, 16h59
  2. Dépendance avec les plugins
    Par epotvin dans le forum Eclipse Platform
    Réponses: 0
    Dernier message: 28/02/2008, 21h52
  3. Gestion des exceptions avec le plugin ErrorHandler ?
    Par AzAt0th dans le forum Zend Framework
    Réponses: 7
    Dernier message: 07/01/2008, 14h31
  4. [M2ECLIPSE] probleme avec le plugin maven-clean-plugin
    Par DanielW33 dans le forum Maven
    Réponses: 6
    Dernier message: 28/05/2007, 19h16
  5. Make: génération des dépendances avec gcc
    Par Syrmonsieur dans le forum Systèmes de compilation
    Réponses: 1
    Dernier message: 08/06/2006, 15h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo