I have some properties in two bash scripts I want substituted when running mvn test, such that one script might be executed before the test phase, and one after, using the exec-maven-plugin.
The bash scripts look like so:
startMongo
#!/bin/bash
${mongodNixDirLocation}/mongod --fork --logpath "${mongodLogDir}" --port ${mongodbTestPort}
/bin/sleep 10
stopMongo
#!/bin/bash
mongoDbServer=`lsof -i tcp:${mongodbTestPort}| awk 'NR!=1 {print $2}'`
for i in $mongoDbServer; do
echo "Stopping mongo DB server instance: $i"
kill -s SIGINT $i
done
I seem to be having issues with the order of execution when I run mvn test. The output is like so.
The exec-maven-plugin is trying to execute the startMongo script before the proper substitutions have been made – hence the error message appearing to execute mongod from /mongod.
If I run mvn process-test-resources, the substitutions are correctly made, and I can manually run the script successfully.
My pom.xml is configured like so. How can I appropriately configure the correct phases such that this will work?
It looks like the problem is in the following line:
If this script –
startMango– needs filtering, the filtering will be done and the result places intarget/test-classesfolder. The original file will not be updated.How about altering the above line as:
Likewise for
stopMongoas well.I am not sure how it manually worked though.