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

Do not depend on junit-platform-engine for the API #31

Closed
piefel opened this issue Jul 26, 2018 · 7 comments
Closed

Do not depend on junit-platform-engine for the API #31

piefel opened this issue Jul 26, 2018 · 7 comments

Comments

@piefel
Copy link

piefel commented Jul 26, 2018

jqwik comes with a dependency on junit-platform-engine:

compile("org.junit.platform:junit-platform-engine:${junitPlatformVersion}")

A little surprsingly, this may cause trouble. I have a Maven project that also uses JUnit Jupiter tests and only has the dependency on junit-jupiter-engine in the Surefire configuration (Jupiter, in contrast to jqwik, comes with two dependencies, one for the API and one for the engine).

When running tests through IntelliJ in this project with 3 engines, often IntelliJ cannot find the tests. The details are not too important (issue raised with JetBrains), but the solution is to exclude the dependency on the platform engine in the POM.

My request here is to split jqwik into API and engine as Jupiter does. Alternatively, exluding junit-platform-engine from the exported dependencies may help, and a note in the docs to include it for the few users that use jqwik exclusively and thus do not get the dependency in any other way.

@jlink
Copy link
Collaborator

jlink commented Jul 26, 2018

Thanks for pointing that out. I'll have a look at it...

@jlink
Copy link
Collaborator

jlink commented Jul 26, 2018

If I understand you correctly, it's basically an IntelliJ bug - maybe you can paste in the youtrack ID from youtrack.jetbrains.com so that I can follow the progress.

Creating two artefacts would be

  1. quite a big change to the way I currently do releases
  2. an additional burden for those users that don't run into your problem

Your second suggestion does also not feel right, because it would lie about the real dependency.

I'm not a maven expert, so here's my question: Does Maven provide a way to exclude transparent dependencies (I loosely remember an tag)? Gradle also has such a mechanism, and I could document the steps to work around this IntelliJ issue until it will be resolved.

What do you think?

@piefel
Copy link
Author

piefel commented Jul 27, 2018

It is an IntelliJ problem, that’s correct. There is no YouTrack ticket, only my support ticket which is not public. I don’t see why test discovery should be affected by things on the classpath, but there it is. The IntelliJ test support may depend too much on the structure that JUnit 5 uses itself (separated API and engine).

I don’t know what transparent dependencies are, but assuming you mean transitive, then of course, they can be excluded, and that is in fact what I’m doing:

    <dependency>
        <groupId>net.jqwik</groupId>
        <artifactId>jqwik</artifactId>
        <version>${jqwik.version}</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.platform</groupId>
                <artifactId>junit-platform-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

About the ‘lying’ part: I’m not sure it is lying. Nothing in the jqwik library depends on the platform engine. To actually run the tests it is needed, but that is a dependency of the test runtime. You wouldn’t normally include the EL dependency in a WAR when you know it’s going to run in a Tomcat.

Feel free not to fix the dependency, but perhaps leave open this ticket for reference if other people stumble upon the same issue.

@jlink
Copy link
Collaborator

jlink commented Jul 27, 2018

"transparent" should be "transitive" of course :-)

Leaving the issue open for the time being sounds like a good suggestion. I will add the related Gradle code in another comment.

@jlink
Copy link
Collaborator

jlink commented Jul 27, 2018

@piefel Can you point to an example where I can see the IntelliJ bug or the issue tracker ID for it? I could not reproduce your problem in my experiments.

@piefel
Copy link
Author

piefel commented Jul 30, 2018

I can create a small Git repo and share the link: https://github.com/piefel/junit5-migration-maven

@jlink
Copy link
Collaborator

jlink commented Dec 19, 2018

Has hopefully been resolved with #37

@jlink jlink closed this as completed Dec 19, 2018
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