Maven 3 Archetype for Project with Spring、Spring MVC、Hibernate、JPA
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14594303/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven 3 Archetype for Project With Spring, Spring MVC, Hibernate, JPA
提问by user1888243
I'm trying to use Maven 3 to create a project which uses Spring 3, Spring MVC, Hibernate 4, and JPA. However, when I execute:
我正在尝试使用 Maven 3 创建一个使用 Spring 3、Spring MVC、Hibernate 4 和 JPA 的项目。但是,当我执行时:
mvn archetype:generate
Non of the archetypes listed include all of these; and even those which are close seem to be special projects such as projects with Flex. I want to avoid having extra modules such as Flex that would crowd the project and configuration files. So, is there an archetype for Maven 3 that I can use to create such a project?
列出的原型中没有包括所有这些;甚至那些接近的似乎都是特殊的项目,例如使用 Flex 的项目。我想避免使用额外的模块(例如 Flex)来挤占项目和配置文件。那么,我可以使用 Maven 3 的原型来创建这样的项目吗?
采纳答案by Rob
Possible duplicate: Is there a maven 2 archetype for spring 3 MVC applications?
可能的重复:spring 3 MVC 应用程序是否有 maven 2 原型?
That said, I would encourage you to think about making your own archetype. The reason is, no matter what you end up getting from someone else's, you can do better in not that much time, and a decent sized Java project is going to end up making a lot of jar projects.
也就是说,我鼓励您考虑制作自己的原型。原因是,无论你最终从别人那里得到什么,你都可以在短时间内做得更好,一个体面大小的 Java 项目最终会制作大量 jar 项目。
回答by AzizSM
A great Spring MVC quickstart archetypeis available on GitHub, courtesy of kolorobot. Good instructions are provided on how to install it to your local Maven repo and use it to create a new Spring MVC project. He's even helpfully included the Tomcat 7 Maven plugin in the archetypical project so that the newly created Spring MVC can be run from the command line without having to manually deploy it to an application server.
GitHub 上提供了一个很棒的Spring MVC 快速入门原型,由kolorobot 提供。提供了关于如何将其安装到本地 Maven 存储库并使用它来创建新的 Spring MVC 项目的良好说明。他甚至在原型项目中帮助包含了 Tomcat 7 Maven 插件,以便新创建的 Spring MVC 可以从命令行运行,而无需手动将其部署到应用程序服务器。
Kolorobot's example application includes the following:
Kolorobot 的示例应用程序包括以下内容:
- No-xml Spring MVC 3.2 web application for Servlet 3.0 environment
- Apache Tiles with configuration in place,
- Bootstrap
- JPA 2.0 (Hibernate/HSQLDB)
- JUnit/Mockito
- Spring Security 3.1
- 适用于 Servlet 3.0 环境的 No-xml Spring MVC 3.2 Web 应用程序
- 配置到位的 Apache Tiles,
- 引导程序
- JPA 2.0(休眠/HSQLDB)
- JUnit/Mockito
- 春季安全 3.1
回答by Arun Gopalpuri
Take a look at http://start.spring.io/it basically gives you a kick starter with either maven or gradle build.
看看http://start.spring.io/它基本上为您提供了 maven 或 gradle build 的启动器。
Note: This is a Spring Boot based archetype.
注意:这是一个基于 Spring Boot 的原型。
回答by Salim Hamidi
With appFuseframework, you can create an Spring MVC archetype with jpa support, etc ...
使用appFuse框架,您可以创建具有 jpa 支持等的 Spring MVC 原型......
Take a look at it's quickStart guideto see how to create an archetype based on this Framework.
查看它的快速入门指南,了解如何基于此框架创建原型。
Foundational frameworks in AppFuse:
AppFuse 中的基础框架:
- Bootstrap and jQuery
- Maven, Hibernate, Spring and Spring Security
- Java 7, Annotations, JSP 2.1, Servlet 3.0
- Web Frameworks: JSF, Struts 2, Spring MVC, Tapestry 5, Wicket
- JPA Support
- 引导程序和 jQuery
- Maven、Hibernate、Spring 和 Spring Security
- Java 7、注解、JSP 2.1、Servlet 3.0
- Web 框架:JSF、Struts 2、Spring MVC、Tapestry 5、Wicket
- JPA 支持
For example to create an appFuse light archetype :
例如创建一个 appFuse 灯原型:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes
-DarchetypeArtifactId=appfuse-light-struts-archetype -DarchetypeVersion=2.2.1
-DgroupId=com.mycompany -DartifactId=myproject

