Hi,

Please correct me if I'm posting this question to the wrong list.

I'm building a .war using Maven 3.04, and my project source contains a file
src/main/webapp/WEB-INF/xyz.properties. I want the build process to inject
the project version into an entry in that properties file (in the built
artifacts, not in the original source file). I've hit a couple of obstacles.

I tried using resource filtering, putting something like
"myProp=${project.version}" into that properties file and trying to enable
filtering for that directory:

  <build>
    <resources>
      <resource>
        <directory>src/main/webapp/WEB-INF</directory>
        <filtering>true</filtering>
    </resource>
    ...


But, although I can get filtering to work in src/main/resources, I can't
get it to work in this WEB-INF directory.

My other approach was to write a Maven plugin. I wrote a Mojo that I think
does what I want -- it edits the properties file in the target directory
(i.e., target/myProject/WEB-INF/xyz.properties) -- but I can't find the
right phase to attach my goal to. If I apply it to the "package" phase,
it's too late; the .war file has already been created with the unmodified
properties. If I apply it to the "prepare-package" phase, the Mojo doesn't
find a target directory yet.

I'm exploring some uglier options, but I'd appreciate any suggestions.

Thanks,
Josh

Reply via email to