In my project, we created a Maven module to get a specific JBoss AS and unpack it.
Then all test cases can be run under this Jboss AS as a built-in container.
We use jboss-ejb3-embedded-standalone to call the built-in container, however it just finds JBOSS_HOME from the environment variables and uses it to run. Therefore, we must update JBOSS_HOME for installing mvn.
I tried to do this in maven by introducing exec-maven-plugin as shown below:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <executable>env</executable> <environmentVariables> <JBOSS_HOME> C:/Sample/embedded-container/jboss-${version.org.jboss.jbossas} </JBOSS_HOME> </environmentVariables> </configuration> <executions> <execution> <id>resetJbossHome</id> <phase>integration-test</phase> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin>
At the console output, I see
[INFO] --- exec-maven-plugin:1.2.1:exec (resetJbossHome) @ test-embedded --- .... JBOSS_HOME=C:/Sample/embedded-container/jboss-6.1.0.Final
....
But when starting JBOSS, it still starts the one with JBOSS_HOME installed.
In addition, I also tried using maven-antrun-plugin.
<plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>copyRelease</id> <phase>pre-integration-test</phase> <configuration> <tasks> <exec executable="env"> <env key="JBOSS_HOME" value="C:/Sample/embedded-container/jboss-${version.org.jboss.jbossas}"/> </exec> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin>
It turns out the same thing.
Am I wrong in setting up or is there a better way?
source share