0

So I have a Jenkins job wherein as part of the build.

I run one script which creates a folder in the workspace say "test" so the script runs fine and creates the folder test.

After this, I have a maven command wherein I want to access this test folder(as an argument) I am trying it as $workspace/test

but it's not working.

Can anyone guide if i am missing anything here

1 Answers1

0

Can you give us more information - maybe code snippets? I'm not sure what you mean with 'maven command' and '$workspace/test'

If you want use a variable in a pom.xml like:

<path>${workspace}</path>

you will have to assign it in the properties:

<workspace>...location...</workspace>

Otherwise you can use maven preassigned variables like

${basedir}/
  • Thanks for the info @krysztokowski No, I don't want to use inside pom file. In the workspace as part of the first build step the test directory is created via a python script ... Later as part of 2nd build step I am using a maven command wherein I want to pass this directory which is created by the above build step as an argument. basically, I want to know how can I pass the path of "subdirectory inside the workspace" as an argument to a maven build command – Shell_Magic Oct 14 '20 at 15:28
  • @Shell_Magic Sounds like it would be the best to use a variable (for the subdirectory) in your build environment (level above maven). I'm not sure how you build (shell script, jenkins, gitlab) but i would create the variable there and use it from there in the lower levels (maven etc.) Otherwise or furthermore these links could help: https://stackoverflow.com/questions/7513319/passing-command-line-arguments-from-maven-as-properties-in-pom-xml https://stackoverflow.com/questions/10463077/how-to-refer-environment-variable-in-pom-xml – Krysztokowski Oct 14 '20 at 15:47