1

I am trying to set a maven property value based on another property that is sent through the command line.

<profiles>
  <profile>
    <id>desktop</id>
        <activation>
           <property>
               <name>environment</name>
               <value>desktop</value>
           </property>
        </activation>
        <properties>
           <qTest.testCycleId>XXXXXX</qTest.testCycleId>
        </properties>
  </profile>
</profiles>

When I try to use the qTest.testCycleId in one of the plugin like below, I am getting property not resolved error.

<plugin>
  <artifactId>exec-maven-plugin</artifactId>
  <groupId>org.codehaus.mojo</groupId>
  <executions>
    <execution>
      <id>Upload Results to qTest</id>
      <phase>post-integration-test</phase>
      <goals>
        <goal>exec</goal>
      </goals>
      <configuration>
        <executable>${script.executor}</executable>
          <commandlineArgs>${basedir}/scripts/qTest/QTestUploaderCucumber.sh
            ${basedir}
            ${qTest.testCycleId} ${qTest.projectId}
          </commandlineArgs>
      </configuration>
    </execution>
  </executions>
</plugin>

PS - Property is resolved correctly if the profile is activated based on os family like below.

<profile>
  <id>Windows</id>
  <activation>
    <os>
      <family>Windows</family>
    </os>
  </activation>
  <properties>
     <qTest.testCycleId>XXXXXX</qTest.testCycleId>
  </properties>
</profile>

Edit: As requested, please find the command line

mvn verify -DSUT=uat -Denvironment=desktop -DBrowser=chrome "-Dcucumber.options=--tags @Temp" -DforkCount=0 -e

Thanks in advance.

Smile
  • 3,832
  • 3
  • 25
  • 39
JagadeesanV
  • 35
  • 2
  • 7

1 Answers1

0

Finally figured out that it was due to a setting in Intellij. I had to check the environment checkbox under maven profiles.

JagadeesanV
  • 35
  • 2
  • 7