stefanbirkner / system-rules

A collection of JUnit rules for testing code which uses java.lang.System.
http://stefanbirkner.github.io/system-rules
Other
546 stars 71 forks source link

junit 4.12 and compilation issues #77

Open Wouter1 opened 4 years ago

Wouter1 commented 4 years ago

My first problem is that this package refers maven 4.9and 4.11

4.9:

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit-dep</artifactId>
            <version>[4.9,)</version>
        </dependency>

I don't see a direct link to 4.11 but I get compilation errors with my own code where maven tells me that there is version conflict with junit 4.12 that I use

FAIK 4.12 is the latest. Can this library be updated?

I tried to fix this myself but the library does not even build. When I try to do mvn install I immediately get a prompt for my PGP password. I have no clue why, your pom does not contain any ref to GPG but probably some parent does... Anyway PGP stuff on my machine is strictly prohibited for access. So the build fails there.

Can these issues be fixed? I'd like

reftel commented 4 years ago

We have a similar issue. The solution for us is to always add a

          <exclusion>
            <groupId>junit</groupId>
            <artifactId>junit-dep</artifactId>
          </exclusion>
        </exclusions>

around the dependency lines that pull in system-rules. An upgrade (or at least a shift to the new artifactId) would make things easier.

fgarbe commented 4 years ago

My IntelliJ can also not resolve dependencies when using system-rules: Could not find artifact junit:junit-dep:pom:4.9.1-SNAPSHOT

Why does <version>[4.9,)</version> resolve to a SNAPSHOT which is not available in mvn central?

sethjones commented 3 years ago

I solved this issue by forcing a specific junit version, overriding the default provided with junit-dep.

chetansharmagithub commented 3 years ago

For gradle, I solved the issue by replacing testCompile 'com.github.stefanbirkner:system-rules:1.19.0' with testCompile ('com.github.stefanbirkner:system-rules:1.19.0') { exclude group:"junit" , module:"junit-dep" }