Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-679

dependencies in manifest.mf ignored when running maven install

    XMLWordPrintable

Details

    Description

      I use following components / versions:

      arquillian-junit-container - 1.0.0.CR6
      jboss - 7.1.0.Beta1
      jboss-as-arquillian-container-remote - 7.1.0.Beta1
      junit - 4.10

      I have folloging testcase:

      @RunWith(Arquillian.class)
      public class DatasourceSessionBeanTest {

      @Deployment
      public static JavaArchive createTestArchive()

      { JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, "datasource-test.jar"); javaArchive.addClasses(BeanInterceptor.class); javaArchive.addClasses(DatasourceServiceRemote.class, DatasourceSessionBean.class); javaArchive.addClasses(AlcatrazUser.class, DataTransferObject.class); javaArchive.addClasses(AlcatrazDAO.class, MatchMode.class); javaArchive.addAsManifestResource("META-INF/persistence.xml", "persistence.xml"); javaArchive.addAsManifestResource("META-INF/MANIFEST.MF", "MANIFEST.MF"); // javaArchive.addPackages(true, "org.slf4j"); // javaArchive.addPackages(true, "org.jboss.logmanager"); System.out.println(javaArchive.toString(true)); return javaArchive; }

      @EJB(mappedName = "java:app/datasource-test/DatasourceSessionBean")
      private DatasourceServiceRemote datasourceService;

      @Test
      public void testGetByRoid()

      { AlcatrazUser alcatrazUser = datasourceService.getByRoid("2531781"); assertNotNull("Result should not be null.", alcatrazUser); }

      }

      -> A manifest.mf is added containing 'Dependencies: org.slf4j'

      When running the test "as a junit test", slf4j is found and logging works.

      When the tests are executed from maven lifecycle, I get a ClassNotFoundException org.slf4j.Logger and the test fails.
      By adding dependencies to org.slf4j and org.jboss.logmanager to the pom and by adding them to the ShrinkWrap archive (see the two commented lines), the test works, although no logging is done.

      Dependencies to modules in manifest.mf should also be recognized when the tests are run from maven.

      Attachments

        Activity

          People

            bartosz-1 Bartosz Majsak
            michael.voegele@cloudops Michael Voegele (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: