Cargo Maven plugin Token Replacement

637 views Asked by At

I am using cargo-maven plugin and I am trying to use token replacement feature of the plugin. Somehow its not working for me. I think I dont know how to represent token so that cargo can replace it with the value. Here is my plugin config

<configfiles>  
    <configfile>  
        <file>src/main/resources/test.properties</file>  
    </configfile>  
</configfiles>  
<properties>  
    <dchome>/users/target</dchome>  
</properties> 

Contents of my test.properties are as follows:

project.home = $dchome

It would be great if any one can show me an example of how to use token replacement of cargo plugin.

Thanks

1

There are 1 answers

0
Bill Reynolds On

I had this same problem, and came across this page while googling for a solution, so I figured I would post my resolution here in the hope it helps someone else.

The original poster was close to a solution - he just had to use a leading and trailing AT symbol (@) to denote the text he wanted to replace in his property file.

So, the solution is pretty straight-forward; instead of doing this in the test.properties file:

project.home = $dchome

He needed to do this instead:

project.home = @dchome@

Once that change was made the Cargo plugin was able to update the property file with the correct information from the "properties" section of the pom.