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 :

débutant, problème maven et pom.xml


Sujet :

Maven Java

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Février 2009
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 54
    Par défaut débutant, problème maven et pom.xml
    Bonjour, je débute avec java ee et maven.
    J'essaye de faire un .jar avec maven selon l'exemple du livre java ee 6 et glassfish 3, chapitre 6. Les sources sont dispos à l'adresse http://kenai.com/projects/beginninge...runk/chapter06

    voici mon pom.xml :

    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
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <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>org.beginningee6.book</groupId>
        <artifactId>chapter06</artifactId>
        <packaging>jar</packaging>
        <version>2.0</version>
        <name>Chapter 06 - EJB</name>
     
            <dependencies>
            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>javax.persistence</artifactId>
                <version>${javax.persistence-version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>eclipselink</artifactId>
                <version>${eclipselink-version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.extras</groupId>
                <artifactId>glassfish-embedded-all</artifactId>
                <version>${glassfish-version}</version>
            </dependency>
        </dependencies>
        <!--To avoid multiple modules with Maven, here is what you need to manually do (it's not nice, but it works)
        1) Comment the following section (maven-jar-plugin), package the jar, and deploy to GlassFish
        2) Uncomment the following section, package the jar and run the Main class with app client --> 
      <!--  <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${plugin-jar-version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>org.beginningee6.book.chapter06.Main</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
            </plugins>
        </build> -->
     
    </project>

    Et l'erreur :


    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
    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
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
     
    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Chapter 06 - EJB
    [INFO]    task-segment: [package]
    [INFO] ------------------------------------------------------------------------
    [INFO] [resources:resources {execution: default-resources}]
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
    i.e. build is platform dependent!
    [INFO] Copying 1 resource
    Downloading: http://repo1.maven.org/maven2/org/eclipse/persistence/javax.persist
    ence/${javax.persistence-version}/javax.persistence-${javax.persistence-version}
    .pom
    [INFO] Unable to find resource 'org.eclipse.persistence:javax.persistence:pom:${
    javax.persistence-version}' in repository central (http://repo1.maven.org/maven2
    )
    Downloading: http://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/$
    {eclipselink-version}/eclipselink-${eclipselink-version}.pom
    [INFO] Unable to find resource 'org.eclipse.persistence:eclipselink:pom:${eclips
    elink-version}' in repository central (http://repo1.maven.org/maven2)
    Downloading: http://repo1.maven.org/maven2/org/glassfish/extras/glassfish-embedd
    ed-all/${glassfish-version}/glassfish-embedded-all-${glassfish-version}.pom
    [INFO] Unable to find resource 'org.glassfish.extras:glassfish-embedded-all:pom:
    ${glassfish-version}' in repository central (http://repo1.maven.org/maven2)
    Downloading: http://repo1.maven.org/maven2/org/eclipse/persistence/javax.persist
    ence/${javax.persistence-version}/javax.persistence-${javax.persistence-version}
    .jar
    Downloading: http://repo1.maven.org/maven2/org/glassfish/extras/glassfish-embedd
    ed-all/${glassfish-version}/glassfish-embedded-all-${glassfish-version}.jar
    [INFO] Unable to find resource 'org.eclipse.persistence:javax.persistence:jar:${
    javax.persistence-version}' in repository central (http://repo1.maven.org/maven2
    )
    Downloading: http://repo1.maven.org/maven2/org/eclipse/persistence/eclipselink/$
    {eclipselink-version}/eclipselink-${eclipselink-version}.jar
    [INFO] Unable to find resource 'org.eclipse.persistence:eclipselink:jar:${eclips
    elink-version}' in repository central (http://repo1.maven.org/maven2)
    [INFO] Unable to find resource 'org.glassfish.extras:glassfish-embedded-all:jar:
    ${glassfish-version}' in repository central (http://repo1.maven.org/maven2)
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Failed to resolve artifact.
     
    Missing:
    ----------
    1) org.eclipse.persistence:javax.persistence:jar:${javax.persistence-version}
     
      Try downloading the file manually from the project website.
     
      Then, install it using the command:
          mvn install:install-file -DgroupId=org.eclipse.persistence -DartifactId=ja
    vax.persistence -Dversion=${javax.persistence-version} -Dpackaging=jar -Dfile=/p
    ath/to/file
     
      Alternatively, if you host your own repository you can deploy the file there:
     
          mvn deploy:deploy-file -DgroupId=org.eclipse.persistence -DartifactId=java
    x.persistence -Dversion=${javax.persistence-version} -Dpackaging=jar -Dfile=/pat
    h/to/file -Durl=[url] -DrepositoryId=[id]
     
      Path to dependency:
            1) org.beginningee6.book:chapter06:jar:2.0
            2) org.eclipse.persistence:javax.persistence:jar:${javax.persistence-ver
    sion}
     
    2) org.eclipse.persistence:eclipselink:jar:${eclipselink-version}
     
      Try downloading the file manually from the project website.
     
      Then, install it using the command:
          mvn install:install-file -DgroupId=org.eclipse.persistence -DartifactId=ec
    lipselink -Dversion=${eclipselink-version} -Dpackaging=jar -Dfile=/path/to/file
     
      Alternatively, if you host your own repository you can deploy the file there:
     
          mvn deploy:deploy-file -DgroupId=org.eclipse.persistence -DartifactId=ecli
    pselink -Dversion=${eclipselink-version} -Dpackaging=jar -Dfile=/path/to/file -D
    url=[url] -DrepositoryId=[id]
     
      Path to dependency:
            1) org.beginningee6.book:chapter06:jar:2.0
            2) org.eclipse.persistence:eclipselink:jar:${eclipselink-version}
     
    3) org.glassfish.extras:glassfish-embedded-all:jar:${glassfish-version}
     
      Try downloading the file manually from the project website.
     
      Then, install it using the command:
          mvn install:install-file -DgroupId=org.glassfish.extras -DartifactId=glass
    fish-embedded-all -Dversion=${glassfish-version} -Dpackaging=jar -Dfile=/path/to
    /file
     
      Alternatively, if you host your own repository you can deploy the file there:
     
          mvn deploy:deploy-file -DgroupId=org.glassfish.extras -DartifactId=glassfi
    sh-embedded-all -Dversion=${glassfish-version} -Dpackaging=jar -Dfile=/path/to/f
    ile -Durl=[url] -DrepositoryId=[id]
     
      Path to dependency:
            1) org.beginningee6.book:chapter06:jar:2.0
            2) org.glassfish.extras:glassfish-embedded-all:jar:${glassfish-version}
     
    ----------
    3 required artifacts are missing.
     
    for artifact:
      org.beginningee6.book:chapter06:jar:2.0
     
    from the specified remote repositories:
      central (http://repo1.maven.org/maven2)
     
     
     
    [INFO] ------------------------------------------------------------------------
    [INFO] For more information, run Maven with the -e switch
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 4 seconds
    [INFO] Finished at: Sat Oct 09 19:04:04 CEST 2010
    [INFO] Final Memory: 6M/15M
    [INFO] ------------------------------------------------------------------------
    C:\eclipse-jee\workspace\chapter06>
    Merci de votre aide, je ne peux plus avancer dans le livre si je n'arrive même pas à compiler...

  2. #2
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    tu dois remplacer dans le pom.xml les ${javax.persistence-version} et autres par des numéros de version explicite, ou les fournir en paramètre de ta ligne de commande maven via le paramètre -D

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Février 2009
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 54
    Par défaut
    Merci pour l'aide mais je ne sais pas du tout quels numéros de version mettre.
    Le pom.xml du livre m'indique 1.1.0 pour javax.persistence et je n'ai plus que 2 artifacts manquants, mais je ne sais pas quoi mettre pour les autres.

  4. #4
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    bha des versions qui existent

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Février 2009
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 54
    Par défaut
    Je ne sais pas les versions qui existent, le livre dit juste de taper mvn package et de déployer une fois qu'on a BUILD SUCCESFULL qui s'affiche, il n'y a rien sur l'écriture du pom.xml et je n'y comprends pas grand chose.
    Connait tu une version de eclipselink et glassfish-embedded-all qui peuvent marcher ?
    Merci

  6. #6
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    ben ca dépend de ton bouquin pardi!

    Pour faire des recherches sur les artifacts maven, tu as ce site

    http://www.mvnrepository.com

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Février 2009
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 54
    Par défaut
    merci mais j'ai un autre problème maintenant, je vais ouvrir un nouveau post...

Discussions similaires

  1. Problème lecture Artefact avec POM.XML de MAVEN
    Par lemzo84 dans le forum Maven
    Réponses: 0
    Dernier message: 07/09/2014, 19h42
  2. Problème création du pom.xml
    Par Anthony14 dans le forum Maven
    Réponses: 7
    Dernier message: 22/04/2009, 14h35
  3. [Maven 2] Description dans pom.xml
    Par hugo123 dans le forum Maven
    Réponses: 2
    Dernier message: 23/08/2006, 15h29
  4. [XML][XSLT] Débutant {Probléme avec For-each-group}
    Par Silvia12 dans le forum XSL/XSLT/XPATH
    Réponses: 6
    Dernier message: 29/01/2006, 21h38

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