Use @*@ delimiters in Maven resource filtering

It *is* very useful to have filtering on by default, so that is now
the case (in spring-boot-starter-parent). Users can filter resources
by default by adding @*@ placeholders (so as not to clash with Spring
${} placeholders).

Fixes gh-1199
This commit is contained in:
Dave Syer 2014-11-03 11:10:33 +00:00
parent 2e07f003c9
commit a7e1ec842d
3 changed files with 36 additions and 14 deletions

View File

@ -18,4 +18,7 @@ shell.auth: spring
#shell.auth.key.path: ${user.home}/test/id_rsa.pub.pem #shell.auth.key.path: ${user.home}/test/id_rsa.pub.pem
#shell.auth: simple #shell.auth: simple
spring.jmx.enabled: true spring.jmx.enabled: true
info.group: @project.groupId@
info.artifact: @project.artifactId@
info.name: @project.name@
info.version: @project.version@

View File

@ -145,6 +145,15 @@ public class SampleActuatorApplicationTests {
entity.getBody().contains("\"hello\":1")); entity.getBody().contains("\"hello\":1"));
} }
@Test
public void testInfo() throws Exception {
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.port + "/info", String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertTrue("Wrong body: " + entity.getBody(),
entity.getBody().contains("\"artifact\":\"spring-boot-sample-actuator\""));
}
@Test @Test
public void testErrorPage() throws Exception { public void testErrorPage() throws Exception {
ResponseEntity<String> entity = new TestRestTemplate("user", getPassword()) ResponseEntity<String> entity = new TestRestTemplate("user", getPassword())

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd"> <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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -49,13 +50,6 @@
<include>**/application.properties</include> <include>**/application.properties</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<excludes>
<exclude>**/application.yml</exclude>
<exclude>**/application.properties</exclude>
</excludes>
</resource>
</resources> </resources>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
@ -103,6 +97,17 @@
<mainClass>${start-class}</mainClass> <mainClass>${start-class}</mainClass>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<delimiters>
<!-- Provide a delimiter that doesn't clash with Spring ${} placeholders -->
<delimiter>@</delimiter>
</delimiters>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>pl.project13.maven</groupId> <groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId> <artifactId>git-commit-id-plugin</artifactId>
@ -170,17 +175,22 @@
</goals> </goals>
<configuration> <configuration>
<transformers> <transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource> <resource>META-INF/spring.handlers</resource>
</transformer> </transformer>
<transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer"> <transformer
implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
<resource>META-INF/spring.factories</resource> <resource>META-INF/spring.factories</resource>
</transformer> </transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource> <resource>META-INF/spring.schemas</resource>
</transformer> </transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> <transformer
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${start-class}</mainClass> <mainClass>${start-class}</mainClass>
</transformer> </transformer>
</transformers> </transformers>