Uploaded image for project: 'Maven Resources Plugin'
  1. Maven Resources Plugin
  2. MRESOURCES-10

Filtering should handle java.io.File values

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.2
    • None
    • None

    Description

      I'm trying to use filters along with ${basedir} to setup my unit test Derby database. Derby must have a unique directory to build its database in and this becomes a problem in multi-module builds.

      Currently I'm doing this:

      <bean id="wsf.storage.dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName"><value>org.apache.derby.jdbc.EmbeddedDriver</value></property>
        <property name="url"><value>jdbc:derby:target/test/testdb/${pom.artifactId};create=true</value></property>
      </bean>
      

      But I'd like to do this:

      <bean id="wsf.storage.dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName"><value>org.apache.derby.jdbc.EmbeddedDriver</value></property>
        <property name="url"><value>jdbc:derby:${basedir}/target/test/testdb;create=true</value></property>
      </bean>
      

      When I try to do the latter, I get this:

      java.lang.ClassCastException: java.io.File
      at org.codehaus.plexus.util.InterpolationFilterReader.read(InterpolationFilterReader.java:269)
      at org.codehaus.plexus.util.InterpolationFilterReader.read(InterpolationFilterReader.java:162)
      at java.io.Reader.read(Reader.java:100)
      at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:212)
      at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:200)
      at org.apache.maven.plugin.resources.ResourcesMojo.copyFile(ResourcesMojo.java:249)
      at org.apache.maven.plugin.resources.ResourcesMojo.copyResources(ResourcesMojo.java:172)
      at org.apache.maven.plugin.resources.TestResourcesMojo.execute(TestResourcesMojo.java:53)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:415)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:531)

      Attachments

        Issue Links

          Activity

            People

              jesse Jesse Stockall
              mperham Mike Perham
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: