Search code examples
mavenmaven-assembly-plugin

maven assembly plugin filters some files, but not others


I have a project being built on Linux but which needs scripts to be run on windows. So I generate batch files for starting the server under windows. These need to refer to a versioned jar. I also tag the README file with a ${project.version} the version so the uer can easily see about which version the file pertains to .

So I create an assembly descriptor :

...
<files>
    <file>
        <source>README</source>
        <outputDirectory>/</outputDirectory>
        <filtered>true</filtered>
    </file>
    <file>
        <source>start-server.cmd</source>
        <outputDirectory>/</outputDirectory>
        <filtered>true</filtered>
        <lineEnding>dos</lineEnding>
    </file>
</files>
...

In the README file is the line

     README ${project.version}

and in start-server.cmd I have

     VERSION = ${project.version}

and after mvn assembly:assembly and unzipping the generated artifact

I find in README :

     README 1.0.3-SNAPSHOT

and in the start-server.cmd

     VERSION = ${project.version}

I am completely at a loss why it is replaced in one file and not in the other.


Solution

  • Is it possible that you are hitting the issue discussed in this forum, which is to do with @ symbol in the start-server.cmd and maven resource plugin?