Forum Discussion

kmaster's avatar
kmaster
New Contributor
7 years ago
Solved

How do I set a project property through the maven command line?

I'm using the maven-soapui-extension-plugin and I'm trying to figure out a way to run all the tests in a project with a specific tag. I couldn't find a way to do this with the built in tagging featur...
  • kmaster's avatar
    7 years ago

    I've made some progress. I've finally got the pom.xml file to pass in the parameter I wanted for the project property. I deleted the custom project property from the SoapUI and changed the xml to have this instead: 

     

    <projectProperties>
    <value>testExecution=${projectProperty}</value>
    </projectProperties>

     

    I then defined the projectProperty later in the pom right before </project> : 

     

    <properties>
    <projectProperty>Smoke_Test</projectProperty>
    </properties>
    </project>

     

    Trying now to change the value of project property. I've tried -Dproperties.projectProperty=new_val but no luck. 

  • kmaster's avatar
    kmaster
    7 years ago

    Alright figured it out. I changed the project property value (the one right before </project>) to $(projectProperty) and now I can use -DprojectProperty="any_val" to pass in whatever I want. Hope this helps someone later 

     

    Edit: I should note that in order to actually use the property in the test cases, I had used a groovy script and the get data to define it in a script. However, since I deleted it after it won't show up anymore but you can still define the property like such: 

     

    def testExecution = context.expand( '${#Project#testExecution}' )    // the property name is 'testExecution' in my case

     

    I'm not sure whether or not it would work if I hadn't deleted the custom property. It may not have made a difference.