From 79ab5b76f94f6dae273e35246e22aeaf0abf25f6 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende <gu.martinm@gmail.com> Date: Tue, 29 Mar 2016 04:20:06 +0200 Subject: [PATCH] Spring and STOMP, first steps --- SpringJava/STOMP/spring-stomp-server/pom.xml | 117 ++++++++ .../de/spring/stomp/handlers/MyCustomHandler.java | 13 + .../rest/controller/GreetingController.java | 17 ++ .../src/main/resources/log4j2.xml | 53 ++++ .../spring-configuration/mvc/rest/rest-config.xml | 88 ++++++ .../spring-configuration/spring-configuration.xml | 47 +++ .../src/main/webapp/WEB-INF/web.xml | 41 +++ SpringJava/STOMP/spring-stomp/pom.xml | 316 +++++++++++++++++++++ 8 files changed, 692 insertions(+) create mode 100644 SpringJava/STOMP/spring-stomp-server/pom.xml create mode 100644 SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/stomp/handlers/MyCustomHandler.java create mode 100644 SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/webservices/rest/controller/GreetingController.java create mode 100644 SpringJava/STOMP/spring-stomp-server/src/main/resources/log4j2.xml create mode 100644 SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/mvc/rest/rest-config.xml create mode 100644 SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/spring-configuration.xml create mode 100644 SpringJava/STOMP/spring-stomp-server/src/main/webapp/WEB-INF/web.xml create mode 100644 SpringJava/STOMP/spring-stomp/pom.xml diff --git a/SpringJava/STOMP/spring-stomp-server/pom.xml b/SpringJava/STOMP/spring-stomp-server/pom.xml new file mode 100644 index 0000000..08f1537 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/pom.xml @@ -0,0 +1,117 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>de.spring.stomp</groupId> + <artifactId>spring-stomp</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>spring-stomp-server</artifactId> + <packaging>war</packaging> + <name>spring-stomp-server</name> + <url>http://gumartinm.name</url> + <description>STOMP with Spring Framework.</description> + <organization> + <name>Gustavo Martin Morcuende</name> + <url>http://www.gumartinm.name</url> + </organization> + <scm> + <developerConnection>scm:git:http://git.gumartinm.name/JavaForFun</developerConnection> + <url>http://git.gumartinm.name/JavaForFun</url> + </scm> + + + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-oxm</artifactId> + </dependency> + + <!-- Required for WebSockets --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-websocket</artifactId> + </dependency> + + <!-- Required for STOMP --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-messaging</artifactId> + </dependency> + + <!-- Required by spring-webmvc --> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <scope>provided</scope> + </dependency> + + <!-- + Jackson JSON Processor, required by spring-webmvc. See messageConverters + in rest-config.xml + --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + + + <!-- + Required by spring-context for using JSR-303. See LocalValidatorFactoryBean + in rest-config.xml + --> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-validator</artifactId> + </dependency> + + </dependencies> + <build> + <finalName>${project.artifactId}</finalName> + <resources> + <resource> + <directory>${basedir}/src/main/webapp</directory> + <excludes> + <exclude>**/*.*</exclude> + </excludes> + </resource> + <resource> + <directory>${basedir}/src/main/resources/</directory> + <includes> + <include>**/*.*</include> + </includes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>2.6</version> + <configuration> + <webResources> + <resource> + <filtering>true</filtering> + <directory>src/main/webapp</directory> + <includes> + <include>WEB-INF/web.xml</include> + </includes> + </resource> + </webResources> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/stomp/handlers/MyCustomHandler.java b/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/stomp/handlers/MyCustomHandler.java new file mode 100644 index 0000000..6500435 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/stomp/handlers/MyCustomHandler.java @@ -0,0 +1,13 @@ +package de.spring.stomp.handlers; + +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.handler.TextWebSocketHandler; + +public class MyCustomHandler extends TextWebSocketHandler { + + @Override + public void handleTextMessage(WebSocketSession session, TextMessage message) { + + } +} diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/webservices/rest/controller/GreetingController.java b/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/webservices/rest/controller/GreetingController.java new file mode 100644 index 0000000..930aaf8 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/webservices/rest/controller/GreetingController.java @@ -0,0 +1,17 @@ +package de.spring.webservices.rest.controller; + +import java.time.LocalDateTime; + +import org.springframework.messaging.handler.annotation.MessageMapping; +import org.springframework.stereotype.Controller; + + +@Controller +public class GreetingController { + + @MessageMapping("/greeting") + public String handle(String greeting) { + return "[" + LocalDateTime.now() + ": " + greeting; + } + +} diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/resources/log4j2.xml b/SpringJava/STOMP/spring-stomp-server/src/main/resources/log4j2.xml new file mode 100644 index 0000000..281da4f --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/resources/log4j2.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + status: The level of internal Log4j events that should be logged to the console. + Valid values for this attribute are "trace", "debug", "info", "warn", "error" and "fatal". + + monitorInterval: The minimum amount of time, in seconds, that must elapse before the file configuration is checked for changes. + + + see https://logging.apache.org/log4j/2.x/manual/configuration.html + --> +<Configuration status="error" strict="true" monitorInterval="30" + name="XMLConfigTest" packages="org.apache.logging.log4j.test"> + + <!-- + ALL > TRACE > DEBUG > INFO > WARN > ERROR > OFF + + ERROR by default. + --> + + <Appenders> + <Appender type="Console" name="STDOUT"> + <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/> + </Appender> + </Appenders> + <Loggers> + + <!-- + SockJS client disconnects. Requires TRACE level always. + It works because I know for sure I will be using WebSockets when using SockJS. + --> + <Logger + name="org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession" + level="TRACE" additivity="false"> + <AppenderRef ref="STDOUT" /> + </Logger> + + <!-- + General logging Spring. + --> + <Logger name="org.springframework" level="INFO" additivity="false"> + <AppenderRef ref="STDOUT" /> + </Logger> + + + <!-- + Anything else will be using TRACE logging level. + --> + <Root level="INFO"> + <AppenderRef ref="STDOUT"/> + </Root> + </Loggers> +</Configuration> diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/mvc/rest/rest-config.xml b/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/mvc/rest/rest-config.xml new file mode 100644 index 0000000..54b8540 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/mvc/rest/rest-config.xml @@ -0,0 +1,88 @@ +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:mvc="http://www.springframework.org/schema/mvc" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:util="http://www.springframework.org/schema/util" + xmlns:p="http://www.springframework.org/schema/p" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + + <!-- + I am declaring my beans without the automatic annotation. :/ + Better because we are saving memory but it requires more configuration. + + See: org.springframework.web.servlet.config.AnnotationDrivenBeanDefinitionParser + <mvc:annotation-driven/> + --> + + + <context:annotation-config /> + + <context:component-scan base-package="de.spring.webservices.rest"/> + + <!-- + Required beans for generating XML responses from Java objects using JAXB annotations + Jackson also works but it doesn't generate XML with namespaces... O.o + + This implementation will be slower than the one using Jackson :( but I am going to use it just for WADL generation :) + --> + <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> + <property name="packagesToScan" value="org.jvnet.ws.wadl"/> + </bean> + <bean id="jaxbConverter" class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter"> + <constructor-arg ref="jaxbMarshaller" /> + </bean> + + <!-- Required beans for generating JSON responses from Java objects --> + <bean id="jsonObjectMapperFactory" class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean" + p:indentOutput="true" p:failOnEmptyBeans="false"> + <property name="featuresToDisable"> + <array> + <util:constant static-field="com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES"/> + <util:constant static-field="com.fasterxml.jackson.databind.MapperFeature.DEFAULT_VIEW_INCLUSION"/> + </array> + </property> + </bean> + + <util:list id="messageConverters"> + <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" p:objectMapper-ref="jsonObjectMapperFactory"/> + <ref bean="jaxbConverter" /> + <bean class="org.springframework.http.converter.StringHttpMessageConverter" /> + </util:list> + + + <bean name="handlerAdapter" + class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"> + <property name="webBindingInitializer"> + <bean + class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer"> + <!-- It enables us to use JSR-303 --> + <property name="validator"> + <bean class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/> + </property> + </bean> + </property> + <property name="messageConverters" ref="messageConverters" /> + + + <property name="requestBodyAdvice"> + <util:list> + <bean id="requestBodyAdvice" class="org.springframework.web.servlet.mvc.method.annotation.JsonViewRequestBodyAdvice"/> + </util:list> + </property> + + + <property name="responseBodyAdvice"> + <util:list> + <bean id="responseBodyAdvice" class="org.springframework.web.servlet.mvc.method.annotation.JsonViewResponseBodyAdvice"/> + </util:list> + </property> + </bean> + + <bean id="handlerMapping" class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/> + + <mvc:default-servlet-handler /> + +</beans> diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/spring-configuration.xml b/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/spring-configuration.xml new file mode 100644 index 0000000..892d490 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/spring-configuration.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:websocket="http://www.springframework.org/schema/websocket" + + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/websocket + http://www.springframework.org/schema/websocket/spring-websocket.xsd"> + + <!-- + Searches for beans in packages (instead of XML configuration we can use + in this way annotations like @Service, @Endpoint, etc, etc) + --> + <context:component-scan base-package="de.spring.stomp"/> + + <!-- SockJS --> + <websocket:handlers allowed-origins="*"> + <websocket:mapping path="/myHandler" handler="sockJsHandler"/> + <!-- Using SockJS protocol --> + <websocket:sockjs/> + <websocket:handshake-interceptors> + <bean class="org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor"/> + </websocket:handshake-interceptors> + </websocket:handlers> + + <bean id="sockJsHandler" class="org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler"/> + + <bean class="org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean"> + <property name="maxTextMessageBufferSize" value="8192"/> + <property name="maxBinaryMessageBufferSize" value="8192"/> + </bean> + + + <!-- STOMP --> + <websocket:message-broker application-destination-prefix="/app"> + <websocket:stomp-endpoint path="/portfolio"> + <websocket:sockjs/> + </websocket:stomp-endpoint> + <!-- Full-featured broker, see: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-handle-broker-relay --> + <websocket:stomp-broker-relay prefix="/topic,/queue" /> + </websocket:message-broker> + +</beans> diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/webapp/WEB-INF/web.xml b/SpringJava/STOMP/spring-stomp-server/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..00d1c2e --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" + version="2.4"> + + <display-name>Spring STOMP: example</display-name> + + <listener> + <listener-class> + org.springframework.web.context.ContextLoaderListener + </listener-class> + </listener> + + <context-param> + <param-name>spring.profiles.active</param-name> + <param-value>${environment.profile}</param-value> + <param-name>contextConfigLocation</param-name> + <param-value> + classpath*:spring-configuration/*.xml + </param-value> + </context-param> + + <!-- Spring REST support --> + <servlet> + <servlet-name>spring-rest</servlet-name> + <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> + <load-on-startup>1</load-on-startup> + <async-supported>true</async-supported> + <init-param> + <param-name>contextConfigLocation</param-name> + <param-value>classpath*:spring-configuration/mvc/rest/*.xml</param-value> + </init-param> + </servlet> + + <servlet-mapping> + <servlet-name>spring-rest</servlet-name> + <!-- REQUIRED PATTERN BY swagger-ui. IT DOESN'T WORK WITH ANY OTHER o.O --> + <url-pattern>/*</url-pattern> + </servlet-mapping> + +</web-app> diff --git a/SpringJava/STOMP/spring-stomp/pom.xml b/SpringJava/STOMP/spring-stomp/pom.xml new file mode 100644 index 0000000..8630bf6 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp/pom.xml @@ -0,0 +1,316 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>de.spring.stomp</groupId> + <artifactId>spring-stomp</artifactId> + <packaging>pom</packaging> + <version>1.0-SNAPSHOT</version> + <name>spring-stomp</name> + <url>http://gumartinm.name</url> + <description>Emails with Spring Framework</description> + <organization> + <name>Gustavo Martin Morcuende</name> + <url>http://www.gumartinm.name</url> + </organization> + <scm> + <developerConnection>scm:git:http://git.gumartinm.name/JavaForFun</developerConnection> + <url>http://git.gumartinm.name/JavaForFun</url> + </scm> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <spring.version>4.2.5.RELEASE</spring.version> + </properties> + + <profiles> + <profile> + <id>release</id> + <properties> + <environment.profile>release</environment.profile> + </properties> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + </profile> + </profiles> + + <dependencies> + <!-- + 1/3 Required dependency for log4j 2 with slf4j: binding between log4j + 2 and slf4j + --> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <version>2.3</version> + </dependency> + <!-- + 2/3 Required dependency for log4j 2 with slf4j: log4j 2 maven plugin + (it is the log4j 2 implementation) + --> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.3</version> + </dependency> + <!-- + 3/3 Required dependency for getting rid of commons logging. This is + the BRIDGE (no binding) between Jakarta Commons Logging (used by Spring) + and whatever I am using for logging (in this case I am using log4j 2) + See: http://www.slf4j.org/legacy.html We need exclusions in every dependency using + Jakarta Commons Logging (see Spring dependencies below) + --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>1.7.12</version> + </dependency> + + + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + <version>2.2.2</version> + </dependency> + + <!-- Unitary and integration tests --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>2.0.43-beta</version> + <scope>test</scope> + </dependency> + </dependencies> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <!-- + Required dependency for getting rid of commons logging and use my + own logging library (in my case I decided to use log4j 2 under slf4j) + --> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Required for WebSockets --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-websocket</artifactId> + <version>${spring.version}</version> + <!-- + Required dependency for getting rid of commons logging and use my + own logging library (in my case I decided to use log4j 2 under slf4j) + --> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Required for STOMP --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-messaging</artifactId> + <version>${spring.version}</version> + <!-- + Required dependency for getting rid of commons logging and use my + own logging library (in my case I decided to use log4j 2 under slf4j) + --> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- REST API --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>${spring.version}</version> + <!-- + Required dependency for getting rid of commons logging and use my + own logging library (in my case I decided to use log4j 2 under slf4j) + --> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-oxm</artifactId> + <version>${spring.version}</version> + <!-- + Required dependency for getting rid of commons logging and use my + own logging library (in my case I decided to use log4j 2 under slf4j) + --> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + + + <!-- Required by spring-webmvc --> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>4.0.0-b01</version> + <scope>provided</scope> + </dependency> + + <!-- + Jackson JSON Processor, required by spring-webmvc. See messageConverters + in rest-config.xml + --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.6.4</version> + </dependency> + + <!-- + Required by spring-context for using JSR-303. See LocalValidatorFactoryBean + in rest-config.xml + --> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + <version>1.1.0.Final</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-validator</artifactId> + <version>5.2.2.Final</version> + </dependency> + + + <!-- Unitary and integration tests --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + <scope>test</scope> + <!-- + Required dependency for getting rid of commons logging and use my + own logging library (in my case I decided to use log4j 2 under slf4j) + --> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.icegreen</groupId> + <artifactId>greenmail</artifactId> + <version>1.5.0</version> + <scope>test</scope> + </dependency> + </dependencies> + </dependencyManagement> + <build> + + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.19.1</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>2.19.1</version> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + <encoding>${project.build.sourceEncoding}</encoding> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>2.7</version> + <configuration> + <encoding>${project.build.sourceEncoding}</encoding> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.6</version> + <configuration> + <archive> + <manifestEntries> + <Specification-Title>${project.description}</Specification-Title> + <Specification-Version>${project.version}</Specification-Version> + <Specification-Vendor>${project.organization.name}</Specification-Vendor> + <Implementation-Title>${project.description}</Implementation-Title> + <Implementation-Version>${project.version}</Implementation-Version> + <Implementation-Vendor>${project.organization.name}</Implementation-Vendor> + </manifestEntries> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/*IntegrationTest.java</exclude> + </excludes> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + <configuration> + <includes> + <include>**/*IntegrationTest.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> +</project> -- 2.1.4