Bonsoir,
Comme je cherchais justement la fonctionnalité décrite, j'ai été voir le lien et chez moi cela fonctionne.
Alors pour votre facilité, voici mon POM.xml complet :
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
|
<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>testJSf</groupId>
<artifactId>testJSF</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>testJSF Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- This dependency is mandatory otherwise
the file servlet-api-2.3.jar in put in the war in the directory web-inf/lib
but this file is already present in the web container -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.1_02</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.1_02</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.8</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<finalName>testJSF</finalName>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<configuration>
<jbossHome>/javadev/tools/jboss-4.0/</jbossHome>
<port>8080</port>
</configuration>
</plugin>
</plugins>
</build>
</project> |
Mon serveur JBoss se situe dans "c:\javadev\tools\jboss-4.0 (cela explique la valeur du tag "jbosshome").
Voici la commande que je tape pour demande le déploiement :
mvn clean:clean package jboss:harddeploy
où
mvn est le nom de fichier ".bat" (je travaille sous windows XP) pour lancer Maven (l'utilitaire "m2" n'est plus conseiller)
clean:clean me permet de nettoyer mon répertoire "target" avant de recréer le war
package me permet de tout recompiler, lancer les tests unitaire et recréer le war
jboss:harddeploy me permet de déploye vers JBoss (cette commande permet de copier le war dans jbosshome/server/default/deploy et pour un déploiement utilisant JMX il suffit de remplacer jboss:harddeploy par jboss:deploy
Enfin voici la console reçue de la part de Maven :
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
| + Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'clean'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building testJSF Maven Webapp
[INFO] task-segment: [clean:clean, package, jboss:harddeploy]
[INFO] ----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory C:\javadev\prj\testJSF\target
[INFO] Deleting directory C:\javadev\prj\testJSF\target\classes
[INFO] Deleting directory C:\javadev\prj\testJSF\target\test-classes
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[WARNING]
Artifact javax.servlet:servlet-api:jar:2.3:provided retains local scope 'provided' overriding broader scope 'runtime'
given by a dependency. If this is not intended, modify or remove the local scope.
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to C:\javadev\prj\testJSF\target\classes
[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] [war:war]
[INFO] Exploding webapp...
[INFO] Assembling webapp testJSF in C:\javadev\prj\testJSF\target\testJSF
[INFO] Copy webapp webResources to C:\javadev\prj\testJSF\target\testJSF
[INFO] Generating war C:\javadev\prj\testJSF\target\testJSF.war
[INFO] Building war: C:\javadev\prj\testJSF\target\testJSF.war
[INFO] [jboss:harddeploy]
[INFO] Copying C:\javadev\prj\testJSF\target\testJSF.war to C:\javadev\tools\jboss-4.0\server\default\deploy\testJSF.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Thu Apr 19 20:53:02 CEST 2007
[INFO] Final Memory: 6M/11M
[INFO] ------------------------------------------------------------------------ |
Comme vous pouvez le voir (2 lignes au-dessus de "BUILD SUCCESSFUL", le déploiement a bien lieu !
Voila j'espère que cela a peut aider.
lionelh
Partager