Ajouter un archetype-spring-mvc à Maven

Fermé
nbs230591 Messages postés 58 Date d'inscription dimanche 25 août 2013 Statut Membre Dernière intervention 11 juillet 2016 - 11 mars 2015 à 17:20
KX Messages postés 16733 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 31 janvier 2024 - 11 mars 2015 à 18:58
Bonjour,
Je désire créer un projet maven et ,utiliser 'archetype-spring-mvc ' (j'utilise éclipse comme IDE),et comme archetype-spring-mvc n'est pas inclu dans eclipse j'ai essayé de le créer en suivant ce tuto :
https://www.codejava.net/frameworks/spring/creating-a-spring-mvc-project-using-maven-and-eclipse-in-one-minute
Mais malheureusement ceci ne fonctionne pas ! :(
Comment faire alors svp ?
A voir également:

1 réponse

KX Messages postés 16733 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 31 janvier 2024 3 015
11 mars 2015 à 18:58
Bonjour,

Il n'est pas nécessaire d'aller bidouiller Eclipse pour récupérer un archetype. Il suffit d'ouvrir une ligne de commande.

Pour les explications voir Débuter avec Maven

En tapant
mvn archetype:generate
cela te permet de générer un nouveau projet à partir du catalogue d'archetype maintenu par Maven.

Il y en a un certain nombre qui concernent Spring MVC, je les liste ci-dessous (attention : les numéros de raccourcis peuvent changer)

21: remote -> co.ntier:spring-mvc-archetype (An extremely simple Spring MVC archetype, configured with NO XML.)
52: remote -> com.force.sdk:springmvc-archetype (Spring MVC Project with Database.com Support)
122: remote -> com.graphaware.neo4j:graphaware-springmvc-maven-archetype (-)
124: remote -> com.graphaware.neo4j:neo4j-springmvc-maven-archetype (-)
126: remote -> com.highwise:weby (A simple spring mvc + hibernate project archetype)
148: remote -> com.mikenimer:extjs-springmvc-webapp (A maven Archetype to create new EXTJS project powered by a spring MVC service.)
345: remote -> io.fabric8.archetypes:spring-boot-webmvc-archetype (Creates a new Shows how to use Spring Boot with WebMVC in the Java Container)
346: remote -> io.fabric8.archetypes:spring-boot-webmvc-ip-archetype (Creates a new Returns IP address to show service load-balancing)
349: remote -> io.fabric8.archetypes:springboot-webmvc-archetype (Creates a new Spring Boot application using Spring WebMVC)
372: remote -> ml.rugal.archetype:springmvc-spring-hibernate (A pretty useful JavaEE application archetype based on springmvc spring and hibernate)
380: remote -> net.coding.chenxiaobo:base-framework-archetype (base-framework is a authority management system of java web framework, the framework ased on spring, mybatis, spring mvc, apache shiro)
697: remote -> org.appfuse.archetypes:appfuse-basic-gwt-archetype (AppFuse Web Frameworks: JSF, Spring MVC, Struts 2 and Tapestry.)
699: remote -> org.appfuse.archetypes:appfuse-basic-jsf-archetype (AppFuse Web Frameworks: JSF, Spring MVC, Struts 2 and Tapestry.)
701: remote -> org.appfuse.archetypes:appfuse-basic-spring-archetype (AppFuse Web Frameworks: JSF, Spring MVC, Struts 2 and Tapestry.)
703: remote -> org.appfuse.archetypes:appfuse-basic-struts-archetype (AppFuse Web Frameworks: JSF, Spring MVC, Struts 2 and Tapestry.)
705: remote -> org.appfuse.archetypes:appfuse-basic-tapestry-archetype (AppFuse Web Frameworks: JSF, Spring MVC, Struts 2 and Tapestry.)
706: remote -> org.appfuse.archetypes:appfuse-basic-wicket-archetype (AppFuse Web Frameworks: JSF, Spring MVC, Struts 2 and Tapestry.)
833: remote -> org.devnull:devnull-web-archetype (DevNull starter webaapp with Spring MVC, JPA, Groovy and Twitter Bootstrap)
866: remote -> org.fluttercode.knappsack:spring-mvc-jpa-archetype (Spring MVC Knappsack archetype application with setup for JPA)
867: remote -> org.fluttercode.knappsack:spring-mvc-jpa-demo-archetype (Spring MVC Knappsack demo archetype application with JPA)
930: remote -> org.jboss.archetype.wfk:jboss-spring-mvc-archetype (An archetype that generates a starter Spring MVC application with Java EE persistence settings (server bootstrapped JPA, JTA transaction management) for JBoss AS7)
957: remote -> org.jboss.spring.archetypes:jboss-spring-mvc-archetype (An archetype that generates a starter Spring MVC application with Java EE persistence settings (server bootstrapped JPA, JTA transaction management) for JBoss AS7)
958: remote -> org.jboss.spring.archetypes:spring-mvc-webapp (An archetype that generates a starter Spring MVC application with Java EE persistence settings (server bootstrapped JPA, JTA transaction management) for JBoss AS7)
1027: remote -> org.mixer2:mixer2-springmvc-archetype (archetype for SpringMVC web application with mixer2)

Dans les derniers on a des archetypes JBoss, je ne sais pas ce que valent les autres, mais ceux là doivent être pas mal. Pour l'exemple je prends le 958.

cd "C:\...\Workspace"
mvn archetype:generate -DarchetypeGroupId=org.jboss.spring.archetypes -DarchetypeArtifactId=spring-mvc-webapp -DgroupId=spring.mvc -DartifactId=spring-mvc -DinteractiveMode=false
cd spring-mvc
mvn clean install

Pour récupérer le projet dans Eclipse tu fais un
File > Import > Maven > Existing Maven Project
. Tu peux aussi faire un
mvn eclipse:eclipse
puis un
File > Import > General > Existing Project in Workspace
mais tu risques de perdre la nature Maven du projet.
0