Hi, I need to pass the contents of a file as the value of a command-line parameter when invoking a maven goal.
Why? The maven goal I am calling would trigger a server process on a certain port. This goal will be setup in a Jenkins build as a continuous integration test job. And there could be more than one such jenkins job. So I want to ensure that each server process starts on a different port. I have scanned for an available port in a "pre-build" step and have written the identified port to a file port.txt and have ensured that it is available in the Jenkins job's workspace before the Maven build is triggered. What I want to do now is specify a maven goal like below within the Jenkins job I'm writing: integration-test clean install -Dport=$(<port.txt) Assuming that port.txt only contains a string like "6001", the above command should (at runtime) become: integration-test clean install -Dport=6001 And when the job runs, a client should connect a url constructed as below: http://localhost:6001/web_service/myapp Note that the port in the above URL is taken from incoming command-line parameter 'port'. However, when I configured this into Jenkins, the job failed with the stacktrace containg the below: Caused by: java.net.URISyntaxException: Illegal character in authority at index 7: http://localhost:$(<port.txt)/web_service/myapp I am executing the job on Linux and have verified that $(<..) is supported on the version of the shell that I am running. So I think replacing $(<port.txt) with `cat port.txt` is not the answer that might help me. The problem seems to be lying in the way I'm using the maven command-line. Looks like the shell is passing everything it sees on the command-line to Maven which has no clue how to handle it! Hope I made the problem clear. All help is appreciated. -- View this message in context: http://maven.40175.n5.nabble.com/How-to-pass-the-contents-of-a-file-as-the-value-of-a-command-line-parameter-when-invoking-a-maven-gol-tp5767482.html Sent from the Maven - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
