Skip to content

Don't make the directory absolute if it doesn't exist #9

@tomdz

Description

@tomdz

StringTemplate allows loading templates from the classpath which is useful because I can bundle them in a jar and add that as a dependency to the plugin invocation. E.g.:

<groupId>com.webguys</groupId>
<artifactId>string-template-maven-plugin</artifactId>
<version>1.1</version>
<dependencies>
  <dependency>
    <groupId>foo.bar</groupId>
    <artifactId>templates</artifactId>
    <version>1.0</version>
  </dependency>
</dependencies>
<configuration>
  <templates>
    <template>
      <directory>foo/bar/templates/</directory>
      <name>MyAweseomeTemplate</name>
      ...
    </template>
  </templates>
<configuration>

However, StringTemplate uses either the context classloader or the classloader used for loading stringtemplate, and this requires that the directory entry above is a non-absolute resource path (i.e. no leading slash). However the stringtemplate plugin takes that to mean a relative directory which it expands without checking whether that actually exists.
Ideally, the plugin would check if the expanded directory exists, and if not, leave the value unmodified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions