1 Reply Latest reply: Apr 4, 2012 10:38 AM by Bartosz Majsak RSS

add a jar to a web archive

kelly goedert Apprentice

Hi,

 

I am trying to write a test with arquillian cr7 for a seam application, and I need to add seam security libraries to my war test file. I tried to follow some suggestions on this link, https://community.jboss.org/message/607699#607699

 

ShrinkWrap.create(WebArchive.class, "test.war").addLibrary(
    ShrinkWrap.createFromZipFile(JavaArchive.class, MavenResolver.resolve(...)));

 

But MavenResolver class is not found. My dependencies regarding arquillian in the pom.xml file are:

 

<arquillian.version>1.0.0.CR7</arquillian.version>
<dependency>
                                                  <groupId>org.jboss.arquillian.container</groupId>
                                                  <artifactId>arquillian-jbossas-remote-6</artifactId>
                                                  <version>1.0.0.CR2</version>
                                        </dependency>
<dependency>
                                        <groupId>org.jboss.arquillian</groupId>
                                        <artifactId>arquillian-bom</artifactId>
                                        <version>1.0.0.CR7</version>
                                        <type>pom</type>
                                        <scope>import</scope>
                              </dependency>
<dependency>
                                        <groupId>org.jboss.arquillian.extension</groupId>
                                        <artifactId>arquillian-drone-bom</artifactId>
                                        <version>1.0.0.CR3</version>
                                        <type>pom</type>
                                        <scope>import</scope>
                              </dependency>
<dependency>
                              <groupId>org.jboss.arquillian.junit</groupId>
                              <artifactId>arquillian-junit-container</artifactId>
                              <scope>test</scope>
                    </dependency>
                    <dependency>
                              <groupId>org.jboss.arquillian.extension</groupId>
                              <artifactId>arquillian-persistence-api</artifactId>
                              <version>${version.arquillian_persistence}</version>
                              <scope>test</scope>
                    </dependency>
                    <dependency>
                              <groupId>org.jboss.arquillian.extension</groupId>
                              <artifactId>arquillian-persistence-impl</artifactId>
                              <version>${version.arquillian_persistence}</version>
                              <scope>test</scope>
                    </dependency>
<dependency>
                              <groupId>org.jboss.arquillian.extension</groupId>
                              <artifactId>arquillian-drone-impl</artifactId>
                              <scope>test</scope>
                    </dependency>
                    <dependency>
                              <groupId>org.jboss.arquillian.extension</groupId>
                              <artifactId>arquillian-drone-selenium</artifactId>
                              <scope>test</scope>
                    </dependency>
                    <dependency>
                              <groupId>org.jboss.arquillian.extension</groupId>
                              <artifactId>arquillian-drone-selenium-server</artifactId>
                              <scope>test</scope>
                    </dependency>
                    <dependency>
                              <groupId>org.seleniumhq.selenium</groupId>
                              <artifactId>selenium-java</artifactId>
                              <scope>test</scope>
                    </dependency>
                    <dependency>
                              <groupId>org.seleniumhq.selenium</groupId>
                              <artifactId>selenium-server</artifactId>
                              <scope>test</scope>
                              <exclusions>
                                        <exclusion>
                                                  <groupId>org.mortbay.jetty</groupId>
                                                  <artifactId>servlet-api-2.5</artifactId>
                                        </exclusion>
                              </exclusions>
                    </dependency>

 

 

 

Should I import any other dependency? Or is there another way to add the jar files to my war?

 

Thanks

 

Kelly

  • 1. Re: add a jar to a web archive
    Bartosz Majsak Master

    Hi Kelly,

     

    first of all you need to include ShrinkWrap Maven Resolver dependency. This should do the job:

     

    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
      <scope>test</scope>
    </dependency>
    

     

     

    Then in your deploment method add following:

     

    final MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class)
         .loadMetadataFromPom("pom.xml")
         .goOffline();
    
    ShrinkWrap.create(WebArchive.class, "test.war")....
              .addAsLibraries(resolver.artifact("groupId:artifactId").resolveAsFiles());

     

    Hope that helps!