maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carpenter <jcarpen...@overstock.com>
Subject Surefire system property which includes a property dynamically created earlier in the lifecycle by another plugin
Date Fri, 01 May 2009 17:18:53 GMT
I am trying to use a property in the systemProperties section of the
surefire plugin which was dynamically created earlier in the build
lifecycle by another plugin (happens to be the
properties-maven-plugin).  I know the property is actually being set
because I successfully use it elsewhere after the
properties-maven-plugin has run.  I am aware that the surefire plugin
only wants string property values, but I believe the baseUrl property
value I am building up should meet that criteria after interpolation
which occurs when maven wires up the surefire plugin.  The standard
basedir property makes it to my junit test without any problems.

Is there a helper plugin out there I can use to perform the
interpolation before I pass it to the surefire plugin?  I could build
one if I must, but that sounds like a lot of hoop jumping just to solve
this problem.  I tried using the ant-run plugin to set the property, but
that didn't work either.

Am I getting burned by the fact the surefire plugin is first run with
skip=true in the test phase, which is prior to the dynamic property
being set by the properties-maven-plugin?

           <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>init-shared-properties</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>read-project-properties</goal>
                </goals>
                <configuration>
                  <files>
                    <file>foo.properties</file>
                  </files>
                </configuration>
              </execution>
            </executions>
          </plugin>

          ...
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <!-- Skip the normal tests, we'll run them in the
integration-test phase -->
              <skip>true</skip>
              <includes>
                <include>**/SimpleSmokeTest.java</include>
              </includes>
            </configuration>
            <executions>
              <execution>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <skip>false</skip>
                  <testFailureIgnore>true</testFailureIgnore>
                  <systemProperties>
                    <property>
                      <name>basedir</name>
                      <value>${basedir}</value>
                    </property>
                    <property>
                      <name>baseUrl</name>

<value>http://localhost:${conf.tomcat.http.port}/</value>
                    </property>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>

CONFIDENTIALITY NOTICE:  This message is intended only for the use and review of the individual
or entity to which it is addressed and may contain information that is privileged and confidential.
 If the reader of this message is not the intended recipient, or the employee or agent responsible
for delivering the message solely to the intended recipient, you are hereby notified that
any dissemination, distribution or copying of this communication is strictly prohibited. 
If you have received this communication in error, please notify sender immediately by telephone
or return email.  Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message