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 :

dev de plugin Ant pour Maven 2


Sujet :

Maven Java

  1. #1
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut dev de plugin Ant pour Maven 2
    suite a une discussion je suis en train d'etudier le developpement d'un plugin Ant pour Maven
    en suivant le tutoriel suivant.
    Malheureusement pour la premiere partie ("Getting started : Hello World") j'ai deja des probleme :
    Apres avoir creer les fichiers "hello.build.xml","hello.mojos.xml" et "pom.xml":
    je peux lancer la commande "mvn -U install" --> jusque la pas de probleme, il m'installe bien mon plugin
    ../.m2\repository\plugins\hello-plugin\1.0-SNAPSHOT\hello-plugin-1.0-SNAPSHOT.jar

    Mais ensuite en lancant la commande "mvn org.myproject.plugins:hello-plugin:hello"
    j'ai une 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
     
    D:\>mvn org.myproject.plugins:hello-plugin:hello
    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [ERROR] FATAL ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] null
    [INFO] ------------------------------------------------------------------------
    [INFO] Trace
    java.lang.NullPointerException
            at org.apache.maven.plugin.descriptor.PluginDescriptor.getMojo(PluginDescriptor.java:259)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1524)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:381)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:135)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
            at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
            at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
            at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: < 1 second
    [INFO] Finished at: Thu Jul 27 16:21:50 CEST 2006
    [INFO] Final Memory: 1M/3M
    [INFO] ------------------------------------------------------------------------

  2. #2
    Expert éminent

    Avatar de denisC
    Profil pro
    Développeur Java
    Inscrit en
    Février 2005
    Messages
    4 050
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : Service public

    Informations forums :
    Inscription : Février 2005
    Messages : 4 050
    Points : 7 641
    Points
    7 641
    Par défaut
    Citation Envoyé par DanielW33
    ../.m2\repository\plugins\hello-plugin\1.0-SNAPSHOT\hello-plugin-1.0-SNAPSHOT.jar
    Tu es sur de ce repertoire? Ca ne me parait pas être le bon? A mon avis, il manque de groupId ce truc....

    Citation Envoyé par DanielW33
    Mais ensuite en lancant la commande "mvn org.myproject.plugins:hello-plugin:hello"
    j'ai une erreur
    Et avec un -X ?

  3. #3
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    les fichiers exemple ( pom.xml , hello.build.xml et hello.mojos.xml) sont un copier-coller du tutorial ils sont placer a la racine D:

    ma commande mvn -U install doit, si je ne m'abuse m'installer le plugin dans mon repository .m2

    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
    D:\>mvn -U install
    [INFO] Scanning for projects...
    [INFO] ----------------------------------------------------------------------------
    [INFO] Building Hello Plugin
    [INFO]    task-segment: [install]
    [INFO] ----------------------------------------------------------------------------
    [INFO] artifact org.apache.maven.plugins:maven-plugin-plugin: checking for updates from central
    [INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for updates from central
    [INFO] artifact org.apache.maven.plugins:maven-compiler-plugin: checking for updates from central
    [INFO] artifact org.apache.maven.plugins:maven-surefire-plugin: checking for updates from central
    [INFO] artifact org.apache.maven.plugins:maven-jar-plugin: checking for updates from central
    [INFO] artifact org.apache.maven.plugins:maven-install-plugin: checking for updates from central
    [WARNING]
            Artifact org.apache.maven:maven-plugin-api:jar:2.0.1:runtime retains local scope 'runtime' overriding broader scope 'compile'
            given by a dependency. If this is not intended, modify or remove the local scope.
     
    [WARNING]
            Artifact org.apache.maven:maven-project:jar:2.0.1:runtime retains local scope 'runtime' overriding broader scope 'compile'
            given by a dependency. If this is not intended, modify or remove the local scope.
     
    [WARNING]
            Artifact org.apache.maven:maven-plugin-descriptor:jar:2.0:runtime retains local scope 'runtime' overriding broader scope 'compile'
            given by a dependency. If this is not intended, modify or remove the local scope.
     
    [WARNING]
            Artifact org.apache.maven:maven-plugin-tools-api:jar:2.0.1:runtime retains local scope 'runtime' overriding broader scope 'compile'
            given by a dependency. If this is not intended, modify or remove the local scope.
     
    [INFO] [plugin:descriptor]
    [WARNING] Goal prefix is: hello; Maven currently expects it to be hello
    [INFO] Using 3 extractors.
    [INFO] Applying extractor for language: java
    [INFO] Extractor for language: java found 0 mojo descriptors.
    [INFO] Applying extractor for language: bsh
    [INFO] Extractor for language: bsh found 0 mojo descriptors.
    [INFO] Applying extractor for language: ant
    [INFO] Extractor for language: ant found 0 mojo descriptors.
    [INFO] [resources:resources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [compiler:compile]
    [INFO] No sources to compile
    [INFO] [resources:testResources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [compiler:testCompile]
    [INFO] No sources to compile
    [INFO] [surefire:test]
    [INFO] No tests to run.
    [INFO] [jar:jar]
    [INFO] Building jar: D:\target\hello-plugin-1.0-SNAPSHOT.jar
    [INFO] [plugin:addPluginArtifactMetadata]
    [INFO] [install:install]
    [INFO] Installing D:\target\hello-plugin-1.0-SNAPSHOT.jar to C:\Documents and Settings\..\.m2\repository\plugins\hello-plugin\1.0-SNAPSHOT\hello-plugin-1.0-SNAPSHOT.jar
    [INFO] [plugin:updateRegistry]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 9 seconds
    [INFO] Finished at: Fri Jul 28 09:57:14 CEST 2006
    [INFO] Final Memory: 5M/11M
    [INFO] ------------------------------------------------------------------------

    ensuite , meme avec le param -X le debug ne me precise pas grand chose
    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
    D:\>mvn -X org.myproject.plugins:hello-plugin:hello
    + Error stacktraces are turned on.
    Maven version: 2.0.4
    [DEBUG] Building Maven user-level plugin registry from: 'C:\Documents and Settings\dweltz\.m2\plugin-registry.xml'
    [DEBUG] Building Maven global-level plugin registry from: 'D:\maven-2.0.4\bin\..\conf\plugin-registry.xml'
    [INFO] Scanning for projects...
    [DEBUG] hello-plugin: resolved to version 1.0-SNAPSHOT from local repository
    [DEBUG] Skipping disabled repository central
    [DEBUG] hello-plugin: using locally installed snapshot
    [DEBUG] hello-plugin: using locally installed snapshot
    [INFO] ------------------------------------------------------------------------
    [ERROR] FATAL ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] null
    [INFO] ------------------------------------------------------------------------
    [DEBUG] Trace
    java.lang.NullPointerException
            at org.apache.maven.plugin.descriptor.PluginDescriptor.getMojo(PluginDescriptor.java:259)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1524)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:381)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:135)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
            at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
            at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
            at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: < 1 second
    [INFO] Finished at: Fri Jul 28 09:49:46 CEST 2006
    [INFO] Final Memory: 1M/3M
    [INFO] ------------------------------------------------------------------------
    la meme erreur apparait

  4. #4
    Membre expérimenté

    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 172
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 172
    Points : 1 524
    Points
    1 524
    Par défaut
    Ton plugin ne contient pas de mojo. Peux-tu l'attacher pour voir à quoi il ressemble.

  5. #5
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    ok je t' uploader tout mon repertoire contenant tous les fichiers de mon plugin

  6. #6
    Membre expérimenté

    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 172
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 172
    Points : 1 524
    Points
    1 524
    Par défaut
    Ton jar ne contient pas le fichier hello.build.xml. Voici les sources du plugin du tutorial
    Fichiers attachés Fichiers attachés

  7. #7
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    Ok, mon erreur etait que je n'avais pas respecter l'arborescence src/main/script... Je suis confus


    Merci pour le coup de main

  8. #8
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    Ok, mon erreur etait que je n'avais pas respecter l'arborescence src/main/script... Je suis confus


    Merci pour le coup de main

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. plugin war pour maven 2
    Par DanielW33 dans le forum Maven
    Réponses: 4
    Dernier message: 29/05/2007, 11h31
  2. Réponses: 1
    Dernier message: 26/04/2007, 14h10
  3. Plugin eclipse pour Maven 2.0
    Par DanielW33 dans le forum Maven
    Réponses: 6
    Dernier message: 12/01/2007, 16h17
  4. plugin shell pour maven 2
    Par DanielW33 dans le forum Maven
    Réponses: 2
    Dernier message: 10/08/2006, 21h12
  5. configuration des plugins Ant pour MAVEN 2
    Par DanielW33 dans le forum Maven
    Réponses: 2
    Dernier message: 31/07/2006, 16h05

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