Skip to content

Instantly share code, notes, and snippets.

@ge0ffrey
Created August 11, 2011 11:31
Show Gist options
  • Save ge0ffrey/1139434 to your computer and use it in GitHub Desktop.
Save ge0ffrey/1139434 to your computer and use it in GitHub Desktop.
@RunWith(Arquillian.class)
public class PrototypeArqTest {
@Deployment
public static JavaArchive createTestArchive() {
return ShrinkWrap.create(JavaArchive.class, "test.jar")
.addClass(RulesRepositoryManager.class)
.addClass(RulesRepository.class)
.addClass(PrototypeArqTest.class)
.addAsManifestResource(new File("src/main/webapp/WEB-INF/beans.xml"));
}
@Inject
private RulesRepository repository;
@Test
public void theRepoIsNotNull() {
assertNotNull(repository);
}
@Test
public void theRepoIsNotNull2() {
assertNotNull(repository);
}
}
=> org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Credentials] with qualifiers [@Default] at injection point [[field] @Inject private org.drools.guvnor.server.repository.RulesRepositoryManager.credentials]
How do I add all my jar dependencies (not 1 at a time please) to ShrinkWrap and all my classes in src/main/java and all my resources in src/main/resources?
@aslakknutsen
Copy link

ish..

@Deployment
public static WebArchive createDeployment() {
    return ShrinkWrap.create(WebArchive.class)
        .addAsResource(new File("target/classes"), "WEB-INF/classes")
        .addAsLibraries(
            DependencyResolvers.use(MavenDependencyResolver.class)
            .includeDependenciesFromPom("pom.xml")
            .resolveAsFiles()
        );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment