Re-org pom.xml to allow Spring Boot 1.3.0 to be used

User can use this pom as a parent and set spring-boot.version.

Also permits "_" as channel name separator.
This commit is contained in:
Dave Syer
2015-05-30 10:25:42 +01:00
parent d11f52170f
commit 6fa01a85bf
3 changed files with 239 additions and 57 deletions

200
pom.xml
View File

@@ -10,12 +10,12 @@
<name>Pivotal Software, Inc.</name>
<url>http://www.spring.io</url>
</organization>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.7</java.version>
<spring-boot.version>1.2.3.RELEASE</spring-boot.version>
<spring-cloud.version>1.0.2.RELEASE</spring-cloud.version>
<spring-xd.version>1.2.0.BUILD-SNAPSHOT</spring-xd.version>
</properties>
<modules>
<module>spring-bus-core</module>
<module>spring-xd-runner</module>
@@ -23,10 +23,17 @@
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>1.0.2.RELEASE</version>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -43,7 +50,7 @@
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-dirt</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>${spring-xd.version}</version>
<exclusions>
<exclusion>
<artifactId>jackson-core-asl</artifactId>
@@ -102,15 +109,188 @@
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-messagebus-redis</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>${spring-xd.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.xd</groupId>
<artifactId>spring-xd-messagebus-rabbit</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>${spring-xd.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<!-- Turn on filtering by default for application properties -->
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/application.yml</include>
<include>**/application.properties</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<excludes>
<exclude>**/application.yml</exclude>
<exclude>**/application.properties</exclude>
</excludes>
</resource>
</resources>
<pluginManagement>
<plugins>
<!-- Apply more sensible defaults for user projects -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>${start-class}</mainClass>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Tests.java</include>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/Abstract*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<mainClass>${start-class}</mainClass>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<delimiters>
<delimiter>${resource.delimiter}</delimiter>
</delimiters>
</configuration>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.1.11</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
</configuration>
</plugin>
<!-- Support our own plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
<!-- Support shade packaging (if the user does not want to use our plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</dependency>
</dependencies>
<configuration>
<keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
<resource>META-INF/spring.factories</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${start-class}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>

View File

@@ -31,7 +31,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.messaging.MessageChannel;
import org.springframework.util.StringUtils;
import org.springframework.xd.dirt.integration.bus.MessageBus;
import org.springframework.xd.dirt.integration.bus.MessageBusAwareRouterBeanPostProcessor;
@@ -69,32 +68,11 @@ public class MessageBusAdapterConfiguration {
String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(beanFactory,
MessageChannel.class);
for (String name : names) {
OutputChannelSpec channel = null;
String prefix = "";
if (name.equals("output")) {
String channelName = module.getOutputChannelName();
channel = new OutputChannelSpec(channelName, beanFactory.getBean(name,
MessageChannel.class));
}
else if (name.startsWith("output.")) {
String channelName = name.substring("output.".length());
if (channelName.contains(":")) {
String[] tokens = channelName.split(":", 2);
String type = tokens[0];
if ("queue".equals(type)) {
// omit the type for a queue
prefix = tokens[1] + ".";
}
else {
prefix = channelName + ".";
}
}
channelName = prefix + getPlainChannelName(module.getOutputChannelName());
channel = new OutputChannelSpec(channelName, beanFactory.getBean(name,
MessageChannel.class));
}
if (channel != null) {
String tapChannelName = StringUtils.hasText(prefix) ? module
String channelName = extractChannelName("output", name, module.getOutputChannelName());
if (channelName != null) {
OutputChannelSpec channel = new OutputChannelSpec(channelName,
beanFactory.getBean(name, MessageChannel.class));
String tapChannelName = !channelName.equals(module.getOutputChannelName()) ? module
.getTapChannelName(getPlainChannelName(channel.getName()))
: module.getTapChannelName();
channel.setTapChannelName(tapChannelName);
@@ -105,6 +83,32 @@ public class MessageBusAdapterConfiguration {
return channels;
}
private String extractChannelName(String start, String name, String externalChannelName) {
if (name.equals(start)) {
return externalChannelName;
}
else if (name.startsWith(start + ".") || name.startsWith(start + "_")) {
String prefix = "";
String channelName = name.substring(start.length() + 1);
if (channelName.contains(":")) {
String[] tokens = channelName.split(":", 2);
String type = tokens[0];
if ("queue".equals(type)) {
// omit the type for a queue
prefix = tokens[1] + ".";
}
else {
prefix = channelName + ".";
}
}
else {
prefix = channelName + ".";
}
return prefix + getPlainChannelName(externalChannelName);
}
return null;
}
private String getPlainChannelName(String name) {
if (name.contains(":")) {
name = name.substring(name.indexOf(":") + 1);
@@ -117,26 +121,8 @@ public class MessageBusAdapterConfiguration {
String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(beanFactory,
MessageChannel.class);
for (String name : names) {
if (name.equals("input")) {
String channelName = module.getInputChannelName();
channels.add(new InputChannelSpec(channelName, beanFactory.getBean(name,
MessageChannel.class)));
}
else if (name.startsWith("input.")) {
String channelName = name.substring("input.".length());
if (channelName.contains(":")) {
String[] tokens = channelName.split(":", 2);
String type = tokens[0];
if ("queue".equals(type)) {
// omit the type for a queue
channelName = tokens[1] + "."
+ getPlainChannelName(module.getInputChannelName());
}
else {
channelName = channelName + "."
+ getPlainChannelName(module.getInputChannelName());
}
}
String channelName = extractChannelName("input", name, module.getInputChannelName());
if (channelName != null) {
channels.add(new InputChannelSpec(channelName, beanFactory.getBean(name,
MessageChannel.class)));
}

View File

@@ -107,6 +107,22 @@ public class MessageBusAdapterConfigurationTests {
assertEquals("tap:stream:foo.bar.module.0", channels.iterator().next().getTapChannelName());
}
@Test
public void noQueueQualifier() throws Exception {
context.registerSingleton("output.foo", new DirectChannel());
Collection<OutputChannelSpec> channels = configuration.getOutputChannels();
assertEquals(1, channels.size());
assertEquals("foo.group.0", channels.iterator().next().getName());
}
@Test
public void underscoreSeparatorForChannelName() throws Exception {
context.registerSingleton("output_foo", new DirectChannel());
Collection<OutputChannelSpec> channels = configuration.getOutputChannels();
assertEquals(1, channels.size());
assertEquals("foo.group.0", channels.iterator().next().getName());
}
@Test
public void overrideNaturalOutputChannelNamedQueue() throws Exception {
module.setOutputChannelName("queue:bar");