[Installation, Configuration & DEPLOYMENT] - How to configure the order of the jars in Maven for TestNG
by Fenixx
Hi all,
according to this link http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/4.... you have to guarantee that the jars for the test of the Embedded JBoss should be declared above any other libraries in the test classpath.
Therefore my question:
Is it a way to configure the order of the jars in Maven?
I tried to configure my pom.xml as follows:
| <plugins>
| <plugin>
| <groupId>org.apache.maven.plugins</groupId>
| <artifactId>maven-ejb-plugin</artifactId>
| <configuration>
| <ejbVersion>3.0</ejbVersion>
| <generateClient>true</generateClient>
| <archive>
| <manifest>
| <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
| <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
| <addClasspath>true</addClasspath>
| <classpathPrefix>lib/</classpathPrefix>
| </manifest>
| <manifestEntries>
| <Class-Path>lib/myproject-server.jar</Class-Path>
| </manifestEntries>
| </archive>
| </configuration>
| </plugin>
|
| <!-- Surefire-->
| <plugin>
| <groupId>org.apache.maven.plugins</groupId>
| <artifactId>maven-surefire-plugin</artifactId>
| <version>2.4.3</version>
| <configuration>
| <childDelegation>true</childDelegation>
| <useSystemClassLoader>false</useSystemClassLoader>
| <environmentVariables>
| <KM_ENV>test</KM_ENV>
| </environmentVariables>
| <skipTests>false</skipTests>
| <testFailureIgnore>true</testFailureIgnore>
| <additionalClasspathElements>
| <!-- Place of the bootstrap-->
| <additionalClasspathElement>${myproject.home}/myproject-ejb/src/test/bootstrap</additionalClasspathElement>
|
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/jboss-embedded-all.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/thirdparty-all.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/jboss-embedded-api.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/jboss-deployers-client-spi.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/jboss-deployers-core-spi.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/jboss-seam.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/jboss-el.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/activation.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/el-api.jar</additionalClasspathElement>
| <additionalClasspathElement>${myproject.home}/myproject-ejb/lib/jsf-api.jar</additionalClasspathElement>
| </additionalClasspathElements>
| <argLine>-Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
| <useSystemClassLoader>false</useSystemClassLoader>
| </configuration>
| <executions>
| <execution>
| <id>surefire-it</id>
| <phase>integration-test</phase>
| <goals>
| <goal>test</goal>
| </goals>
| </execution>
| </executions>
| </plugin>
| <!-- ==================== -->
| </plugins>
|
| <!-- TESTNG-->
| <testResources>
| <testResource>
| <directory>src/test/bootstrap</directory>
| </testResource>
| <testResource>
| <directory>src/test/resources</directory>
| </testResource>
| </testResources>
|
| </build>
| <dependencies>
| <dependency>
| <groupId>org.jboss.seam.embedded</groupId>
| <artifactId>jboss-embedded-all</artifactId>
| <version>beta3.SP4</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.jboss.seam.embedded</groupId>
| <artifactId>hibernate-all</artifactId>
| <version>beta3.SP4</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.jboss.seam.embedded</groupId>
| <artifactId>thirdparty-all</artifactId>
| <version>beta3.SP4</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.jboss.seam.embedded</groupId>
| <artifactId>jboss-embedded-api</artifactId>
| <version>beta3.SP4</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.jboss.microcontainer</groupId>
| <artifactId>jboss-deployers-client-spi</artifactId>
| <version>2.0.0.Beta6</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.jboss.microcontainer</groupId>
| <artifactId>jboss-deployers-core-spi</artifactId>
| <version>2.0.0.Beta6</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>com.gfi.library</groupId>
| <artifactId>authenticator</artifactId>
| <version>1.2.1</version>
| </dependency>
| <dependency>
| <groupId>javax.ejb</groupId>
| <artifactId>ejb-api</artifactId>
| <version>3.0</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>javax.faces</groupId>
| <artifactId>jsf-api</artifactId>
| <version>1.2_09-BETA1</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.jboss.seam</groupId>
| <artifactId>jboss-seam</artifactId>
| <version>2.1.1.GA</version>
| <scope>provided</scope>
| </dependency>
|
| <!-- TEST NG -->
| <dependency>
| <groupId>org.testng</groupId>
| <artifactId>testng</artifactId>
| <version>5.7</version>
| <scope>test</scope>
| <classifier>jdk15</classifier>
| </dependency>
|
| <dependency>
| <groupId>javax.servlet</groupId>
| <artifactId>servlet-api</artifactId>
| <version>2.5</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.jboss.el</groupId>
| <artifactId>jboss-el</artifactId>
| <version>2.0.1.GA</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>javax.el</groupId>
| <artifactId>el-api</artifactId>
| <version>1.0</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>javax.activation</groupId>
| <artifactId>activation</artifactId>
| <version>1.0.2</version>
| <scope>provided</scope>
| </dependency>
| </dependencies>
| </project>
|
But if I want to execute the test with "Run As -> Maven test" my Test-Classpath is built-on as follows:
[DEBUG] Test Classpath :
| [DEBUG] C:\Projekte\My_Project\main\Sourcen_maven\myproject-ejb\target\test-classes
| [DEBUG] C:\Projekte\My_Project\main\Sourcen_maven\myproject-ejb\target\classes
| [DEBUG] c:\Projekte\javalibs\MavenRepository\junit\junit\4.0\junit-4.0.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\log4j\log4j\1.2.14\log4j-1.2.14.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\seam\embedded\jboss-embedded-all\beta3.SP4\jboss-embedded-all-beta3.SP4.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\seam\embedded\jboss-embedded-api\beta3.SP4\jboss-embedded-api-beta3.SP4.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\microcontainer\jboss-deployers-client-spi\2.0.0.Beta6\jboss-deployers-client-spi-2.0.0.Beta6.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\microcontainer\jboss-deployers-core-spi\2.0.0.Beta6\jboss-deployers-core-spi-2.0.0.Beta6.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\seam\embedded\hibernate-all\beta3.SP4\hibernate-all-beta3.SP4.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\seam\embedded\thirdparty-all\beta3.SP4\thirdparty-all-beta3.SP4.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\jboss-common-core\2.2.1.GA\jboss-common-core-2.2.1.GA.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\apache-xerces\xml-apis\2.7.1\xml-apis-2.7.1.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\apache-httpclient\commons-httpclient\2.0.2\commons-httpclient-2.0.2.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\apache-slide\webdavlib\2.0\webdavlib-2.0.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\jboss\jboss-common-logging-spi\2.0.4.GA\jboss-common-logging-spi-2.0.4.GA.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\microcontainer\jboss-managed\2.0.0.Beta6\jboss-managed-2.0.0.Beta6.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\aop\jboss-aop\2.0.0.beta1\jboss-aop-2.0.0.beta1.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\ant\ant\1.6.5\ant-1.6.5.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\javassist\3.6.0.GA\javassist-3.6.0.GA.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\qdox\qdox\1.6\qdox-1.6.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\trove\trove\2.1.1\trove-2.1.1.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\microcontainer\jboss-container\2.0.0.Beta6\jboss-container-2.0.0.Beta6.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\jbossxb\2.0.0.CR4\jbossxb-2.0.0.CR4.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\apache-xerces\xercesImpl\2.7.1\xercesImpl-2.7.1.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\wutka-dtdparser\dtdparser121\1.2.1\dtdparser121-1.2.1.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\javax\activation\activation\1.0.2\activation-1.0.2.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\jboss\jboss-logging-spi\2.0.3.GA\jboss-logging-spi-2.0.3.GA.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\microcontainer\jboss-metatype\2.0.0.Beta6\jboss-metatype-2.0.0.Beta6.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\com\cryptix\cryptix32\3.2.0\cryptix32-3.2.0.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\apache\axis\axis\1.4\axis-1.4.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\apache\axis\axis-jaxrpc\1.4\axis-jaxrpc-1.4.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\javax\ejb\ejb-api\3.0\ejb-api-3.0.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\javax\faces\jsf-api\1.2_09-BETA1\jsf-api-1.2_09-BETA1.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\seam\jboss-seam\2.1.1.GA\jboss-seam-2.1.1.GA.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\jboss\el\jboss-el\2.0.1.GA\jboss-el-2.0.1.GA.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\javax\el\el-api\1.0\el-api-1.0.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\org\testng\testng\5.7\testng-5.7-jdk15.jar
| [DEBUG] c:\Projekte\javalibs\MavenRepository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/conf/bootstrap-beans.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/conf/jbossjta-properties.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/conf/jboss-service.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/conf/login-config.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/messaging/connection-factories-service.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/messaging/destinations-service.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/messaging/hsqldb-persistence-service.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/messaging/jms-ds.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/messaging/legacy-service.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/messaging/messaging-service.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/messaging/remoting-service.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/ejb3-interceptors-aop.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/hsqldb-ds.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/jboss-local-jdbc.rar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/jboss-xa-jdbc.rar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deploy/remoting-service.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deployers/aspect-deployer-beans.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deployers/ejb3-deployers-beans.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deployers/jboss-aspect-library-beans.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deployers/jca-deployers-beans.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deployers/metadata-beans.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/META-INF/persistence.properties
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/jndi.properties
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/META-INF/commons-logging.properties
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deployers/log4j.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/src/test/bootstrap/deployers/resources/META-INF/persistence.xml
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/jboss-embedded-all.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/thirdparty-all.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/jboss-embedded-api.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/jboss-deployers-client-spi.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/jboss-deployers-core-spi.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/jboss-seam.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/jboss-el.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/activation.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/el-api.jar
| [DEBUG] C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/lib/jsf-api.jar
As you see: Nearly the full local repository is loaded in my test classpath.
Additionally I get this error:
org.jboss.deployers.spi.DeploymentException: Unable to find deployDir from url: file:/C:/Projekte/My_Project/main/Sourcen_maven/myproject-ejb/target/test-classes/deploy/
| at org.jboss.embedded.DeploymentGroup.getDeployerDirUrls(DeploymentGroup.java:550)
| at org.jboss.embedded.DeploymentGroup.getDeployerDirUrlsFromResource(DeploymentGroup.java:536)
| at org.jboss.embedded.DeploymentGroup.addDirectoryByResource(DeploymentGroup.java:465)
Here is my Test-Code:
public class MyTest extends SeamTest
| {
| @Test
| public void sayHello()
| {
| assert true;
| }
| }
I don't know what is wrong. The test is running correctly with the TestNG-Plugin.
Can you give me a hint or something?
Regards
Fenixx
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4222513#4222513
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4222513
15 years, 9 months