Bonjour, je suis en train d essayer de créer un plugins pour maven, pour cela je commence par faire le tuto de plugins présent ici :

http://maven.apache.org/guides/plugi...velopment.html

J'ai donc executer ces lignes de commandes :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
mvn archetype:create -DgroupId=sample.plugin -DartifactId=maven-hello-plugin
Ensuite dans ma page JAVA, j'ai mis ce code :
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
package sample.plugin;
 
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
 
/**
 * Says "Hi" to the user.
 * @goal sayhi
 */
public class GreetingMojo extends AbstractMojo
{
    public void execute() throws MojoExecutionException
    {
        getLog().info("Hello, world.");
    }
}
Ensuite j'ai mis ceci dans 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
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>sample.plugin</groupId>
  <artifactId>maven-hello-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>maven-hello-plugin</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>2.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
     <plugin>
      <groupId>sample.plugin</groupId>
      <artifactId>maven-hello-plugin</artifactId>
      <version>1.0-SNAPSHOT</version>
     </plugin>
    </plugins>
  </build>
</project>
Et pour finir je lance cette ligne de commande:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
mvn sample.plugin:maven-hello-plugin:1.0-SNAPSHOT:sayhi
Et j'ai ce log :
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
 
[INFO] Scanning for projects...
[INFO] Cannot find mojo descriptor for: 'sample.plugin:maven-hello-plugin:1.0-SNAPSHOT:sayhi' - Treating as non-aggregator.
[INFO] ----------------------------------------------------------------------------
[INFO] Building maven-hello-plugin
[INFO]    task-segment: [sample.plugin:maven-hello-plugin:1.0-SNAPSHOT:sayhi]
[INFO] ----------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository
 
Try downloading the file manually from the project website.
 
Then, install it using the command:
    mvn install:install-file -DgroupId=sample.plugin -DartifactId=maven-hello-plugin \
        -Dversion=1.0-SNAPSHOT -Dpackaging=maven-plugin -Dfile=/path/to/file
 
 
  sample.plugin:maven-hello-plugin:maven-plugin:1.0-SNAPSHOT
 
from the specified remote repositories:
  central (http://repo1.maven.org/maven2)
 
  sample.plugin:maven-hello-plugin:maven-plugin:1.0-SNAPSHOT
 
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: < 1 second
[INFO] Finished at: Fri Feb 02 11:05:02 CET 2007
[INFO] Final Memory: 1M/2M
[INFO] ------------------------------------------------------------------------
Je ne comprend pas ce que cela veut dire, si vous avez une idée n'hésitez pas.
Merci