salut,
voici une configuration qui fonctionne chez moi marche,
cependant le tomcat est dans le dossier target donc recréer(mais pas téléchargé) à chaque build
toi tu utilise l'ancien projet de tomcat-maven qui a migré chez apache et plus chez codehaus et je t'invite aussi a aller sur la page apache du projet
http://tomcat.apache.org/maven-plugin.html
http://tomcat.apache.org/maven-plugin-2.0/
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
|
<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>
.
.
.
<properties>
<tomcat-maven-plugin.version>2.0</tomcat-maven-plugin.version>
</properties>
.
.
.
<build>
<finalName>foobar</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<path>/${project.build.finalName}</path>
<port>8080</port>
<charset>UTF-8</charset>
<finalName>${project.build.finalName}</finalName>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<name>Central Repository</name>
</repository>
</repositories>
</project> |
et enfin tu lance la commande à la racine de ton projet ou crée un raccourcie dans run configuration sous eclipse
avec tests
mvn org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:run-war
sans tests
mvn -DskipTests=true org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:run-war
http://localhost:8080/foobar
Partager