Trying to create a spring project with maven

Greetings to everyone I just tried the http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html spring tutorial, and I thought that its old, I’ll think something better on mine. For starters, how do I start a spring project with maven, which type should I choose? I want to create a simple spring application, write a class that I will use for jboss, spring will run it at startup. Here is what I mean now .. for now I need to start it first

+5
source share
4 answers

The archetype only sets up your POM and directory structure based on the template. I would not hang up on which to choose.

The MVC tutorial uses the following structure:

  • src - Java source code
  • war - contextual files of web resources, web.xml and Spring

If you want to use Maven standards, this should be converted to

  • src/main/java - Java source code
  • src/main/resources - Spring context files and configuration files (not related to websites) that you want to use in the classpath (e.g. WEB-INF / classes) in a web application
  • src/main/webapp - Resources related to websites you want to see at the root of your webapp / .war file

And <packaging>for webapp it should be war.

. Maven by Example book, Maven, " -". Maven: .

+4

Spring 3 maven . : https://src.springframework.org/svn/spring-samples/

- AppFuse archetype, , appfuse-modular-spring Hibernate, Spring Spring MVC.

+6

appfuse maven webapp spring, hibernate spring MVC

artifactId: appfuse-basic- spring groupId: org.appfuse.archetypes

+1

You can create a project using the web archetype:

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp

Then add spring as a dependency in the generated pom.xml to get the spring banners:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring</artifactId>
    <version>2.5.6</version>
</dependency>

You can follow spring tutorials.

You will need to upgrade the original version of java to 1.5 in pom for annotations, etc., it describes how to do this on the maven site.

0
source

All Articles