I found a Maven plugin at Google that can replace tokens which I applied to
the filtered xml file.
This does remove the backslashes, however I think a much better solution
would be for Maven to have a simple and direct means of obtaining a file:URL
with correct form via a Maven project property.
Perhaps something like ${project.parent.basedir.url}? At this stage a
feature such as this might be more relevant as a Maven 3.0 addition?
Here is an example of using the maven-replacer-plugin configuration that can
replace tokens:
<plugin>
<groupId>bakersoftware</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>0.0.9</version>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<file>target/test-classes/persistence.xml</file>
<token>\\</token>
<value>/</value>
</configuration>
</execution>
</executions>
</plugin>
stug23 wrote:
>
> Is there a way in Maven 2.0.9 to end up with forward slashes in a
> file/directory pathname on the Windows platform when filtering a property
> such as ${project.parent.basedir}?
>
> I need to supply a file URL for a Hibernate URL specified in a
> persistence.xml configuraton file. The following property statement from a
> persistence.xml file gets filtered as a resource file from
> src/test/resources into the test-classes directory under target.
>
> However on Windows the pathname ends up including backslashes which don't
> play well with Hibernate. The JPA hibernate entity manager cannot resolve
> a URL with backslashes in it.
>
> The XML element in questions looks more or less like this:
>
> <property name="hibernate.connection.url"
> value="jdbc:hsqldb:file:///${project.parent.basedir}/target/hsql/testdb"/>
>
> Suggestions on how to accomplish this would be appreciated.
>
> TIA!
>
>
--
View this message in context:
http://www.nabble.com/Properties%3A-backslashes-in-pathname-on-Windows-tp23209361p23219538.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]