External properties in arquillian.xml
suikast42 Apr 5, 2012 4:53 AMHi @ all,
I have problems to set system properties in arquillian.xml.
I do folowing things:
1. Define properties in surfire.
2. Refrence the surfire properties in arquillian.xml
My surfire conf:
<plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version-surfire}</version>
                <inherited>true</inherited>
                <configuration>
                    <enableAssertions>true</enableAssertions>
                    <configuration>
                        <enableAssertions>true</enableAssertions>
                        <!-- -DserverProfile=standalone-full-my.xml -DwmsEar=com.my.company:my-ear:ear:3.0.0-SNAPSHOT -->
                        <systemPropertiesFile>
                            ${user.home}/mvntest.properties
                        </systemPropertiesFile>
                        <systemPropertyVariables>
                            <serverProfileSurfire>${serverProfile}</serverProfileSurfire>
                            <earSurfire>${ear}</earSurfire>
                            <serverDirSurfire>${serverDir}</serverDirSurfire>
                        </systemPropertyVariables>
                    </configuration>
                </configuration>
            </plugin>
My arquillian.xml
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://jboss.org/schema/arquillian"
  xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
  <container qualifier="jboss7" default="true">
    <protocol type="Servlet 3.0">
      <property name="executionType">MANAGED</property>
    </protocol>
  <configuration>
        <property name="serverConfig">${serverProfileSurfire}</property>
      <property name="jbossHome">${serverDirSurfire:F:\IDE\jboss-as-7.1.1.Final}</property>
      <property name="javaVmArguments">-Xmx512m -XX:MaxPermSize=128m -Xrunjdwp:transport=dt_socket,address=8086,server=y,suspend=n</property>
      <property name="allowConnectingToRunningServer">true</property>
    </configuration>
  </container>
</arquillian>
Surfire can read the properties from the prop file and set this. But Arquillian throw the Exception which is shown below:
java.lang.IllegalStateException: JBAS014805: Could not get main file: ${serverProfileSurfire}. Specified files must be relative to the configuration dir: F:\IDE\jboss-as-7.1.1.Final\standalone\configuration
    at org.jboss.as.controller.persistence.ConfigurationFile.determineMainFile(ConfigurationFile.java:148)
    at org.jboss.as.controller.persistence.ConfigurationFile.<init>(ConfigurationFile.java:90)
    at org.jboss.as.server.ServerEnvironment.<init>(ServerEnvironment.java:375)
    at org.jboss.as.server.Main.determineEnvironment(Main.java:242)
    at org.jboss.as.server.Main.main(Main.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.jboss.modules.Module.run(Module.java:260)
    at org.jboss.modules.Main.main(Main.java:291)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.219 sec <<< FAILURE!
I try to set the propertis with mvn -DserverProfile , too but the same result.
What I'm doing wrong ?