# Datasource definition containing backslashes causes problems in server.xml generation

## Description

I am using Cargo to set up Tomcat with a JDBC connection to a HSQLDB file-based database in a multi-module project.

For a number of reasons, we need to use {{${project.build.directory}}} in the JDBC URL string. However, putting this in the pom... 1 2 3 4 <cargo.datasource.datasource> cargo.datasource.url=jdbc:hsqldb:file:${project.build.directory}/database/db| ... other properties ... </cargo.datasource.datasource>

... does not generate a valid conf/server.xml file under Windows. Imagine my project's target directory is C:\foo\bar\baz\target - this is the result...

Server.xml

1 2 <Resource url='jdbc:hsqldb:file:C:foobarbaz arget/database/db' ...other attrs.../>

This will obviously cause an error on container startup - the backslashes are not being escaped correctly and so the database cannot be found. There are no workarounds for us as far as I know.

One solution might be to escape the backslashes in the string, similar to how the Maven Resources plugin works: http://maven.apache.org/plugins/maven-resources-plugin/xref/org/apache/maven/plugin/resources/ReflectionProperties.html#62.
0

Jason Royals

0.3.1-maven2

Minor