Suresh Rohan's Blog

This blog is all about Java, J2EE,Spring, Angular, React JS, NoSQL, Microservices, DevOps, BigData, Tutorials, Tips, Best practice, Interview questions, Views, News, Articles, Techniques, Code Samples, Reference Application and much more

Monday, April 15, 2013

First Steps for Spring Integration using Maven


We will start with creating a Maven project and show how to add the necessary library support. The simplest method to create a Maven project is to use an archetype, as follows:

1. For a command window, enter mvn archetype:generate.
2. Choose maven-archetype-quickstart from the list of options, which provides a sample Maven project.
3. Select the latest version of the archetype and enter com.equinox.springintegration for the groupId, firstproject for the artifactId, and the defaults for version and package . Then enter Return to create the project.

Maven Dependencies for Spring Integration


<dependency>
     <groupId>org.springframework.integration</groupId>
     <artifactId>spring-integration-core</artifactId>
     <version>2.0.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-jms</artifactId>
    <version>2.0.1.RELEASE</version>
</dependency>

In addition, the Spring repositories may be needed, especially when using the
milestone and snapshot


<repositories>
<repository>
<id>repository.springframework.maven.release</id>
<name>Spring Framework Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
</repository>
<repository>
<id>org.springframework.maven.milestone</id>
<name>Maven Central Compatible Spring Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<id>org.springframework.maven.snapshot</id>
<name>Maven Central Compatible Spring Snapshot Repository</name>
<url>http://maven.springframework.org/snapshot</url>
</repository>
</repositories>


The following configuration must be added to ensure that the code compiles against Java SE 6, and that the resources directory isn’t filtered

pom.xml Build Element for Java SE 6


<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>




No comments:

Post a Comment