Spring & Hibernate Maven Building

I have a relatively simple question regarding spring and maven sleep mode.

Let's say I have a project A, in which during the project setup all banks were added, added to the library during the project setup - there was no Maven POM. It is assumed that everything in this project works without problems.

Now take project B. This project will replicate project A, but will be configured using Maven POM.

My question comes at the stage of dependency configuration. Take this image

Project A JAR Lib

lib A, JAR , maven MVN Repo POM B? " " spring maven.

, , Maven POMs.

.

+4
4

, ( !), " spring". Maven spring spring.

, JAR , (- webmvc, iirc).

: ( ) - :

<properties>
    <spring.version>4.1.5.RELEASE</spring.version>
</properties>

:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>${spring.version}</version>
</dependency>
+1

, - maven .

: http://mvnrepository.com/

" spring", pom, spring, , . .

- (, jar - java-, , maven)

+1
source

You can use spring-frame-bom as follows:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-framework-bom</artifactId>
            <version>4.0.1.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
    </dependency>

    ...
<dependencies>

Or you can declare a pom property with spring version:

<properties>
    <spring-version>4.0.1.RELEASE</spring-version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring-version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${spring-version}</version>
    </dependency>

    ...
<dependencies>

Here you can find the most common dependencies: http://spring.io/blog/2009/12/02/obtaining-spring-3-artifacts-with-maven/

+1
source

All Articles