Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch between MavenDependencyAppender #3

Open
flavienlaurent opened this issue Jul 17, 2018 · 3 comments
Open

Switch between MavenDependencyAppender #3

flavienlaurent opened this issue Jul 17, 2018 · 3 comments

Comments

@flavienlaurent
Copy link

Is there a simple way to have multiple MavenDependencyAppender and to switch between them at the test level?

I'm looking for something to be able to run one test with default libs, then run one test with jpa related libs, then run one test with web services related lib and so on.

Thanks for your work!

@urbim
Copy link
Member

urbim commented Jul 17, 2018

No, currently not, but there are some other options.

If your project is separated in multiple modules (jpa, rest, etc.) you can have one MavenDependencyAppender per module.

You could also include all your libraries in all your tests. Usually that doesn't cause much trouble.

@flavienlaurent
Copy link
Author

Thanks for your response. You're right, it doesn't cause much trouble but sometimes, you want your test configuration to be as clear as possible and your execution as fast as possible ;)

@urbim
Copy link
Member

urbim commented Jul 17, 2018

Yes, of course.

You could configure libraries when creating deployments, something like this:

@Deployment
public static WebArchive createDeployment() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class);
    // add classes to jar

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibrary(jar);
            .addAsLibrary(additionalLibrary);
}

The adapter will then correctly restructure deployment to exploded format. As for the additionalLibrary parameter, you can resolve a library with Maven using the ShrinkWrap Resolvers. We are actually using this tool to resolve MavenDependencyAppender libraries here.

But this is not so simple anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants