dhamini-poornachandra / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

Dependencies in mockito-core.pom pull hamcrest-core and objenesis #307

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Create Maven project, e.g. by running "mvn archetype:generate" and selecting 
"org.apache.maven.archetypes:maven-archetype-quickstart"
2. Add "org.mockito:mockito-core" as dependency
3. Run "mvn dependency:tree"

What is the expected output? What do you see instead?

I would expect that the dependency tree would contain neither 
"org.hamcrest:hamcrest-core" nor "org.objenesis:objenesis". However, it does:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mockito-issue 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ mockito-issue ---
[INFO] com.example:mockito-issue:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.1:test
[INFO] \- org.mockito:mockito-core:jar:1.9.0:test
[INFO]    +- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO]    \- org.objenesis:objenesis:jar:1.0:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.150s
[INFO] Finished at: Wed Jan 11 15:30:59 CET 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------

As workaround, I have to explicitly exclude these dependencies:

    <dependency><!-- mocking framework -->
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId><!-- theoretically, needs extra dependencies: objenesis & hamcrest -->
      <version>1.9.0</version>
      <scope>test</scope>
      <exclusions><!-- however, we have to exclude objenesis & hamcrest explicitly -->
              <exclusion>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-core</artifactId>
              </exclusion>
              <exclusion>
                <groupId>org.objenesis</groupId>
                <artifactId>objenesis</artifactId>
              </exclusion>
            </exclusions>
    </dependency>

Then, it works as expected.

Original issue reported on code.google.com by mburger313@gmail.com on 11 Jan 2012 at 2:36

GoogleCodeExporter commented 8 years ago
I don't understand what's the problem :)

The dependencies are included, because without them mockito will now work... 
There's also a different artifact: mockito-all that is self-contained and does 
not declare any dependencies.

Cheers!

Original comment by szcze...@gradle.biz on 12 Jan 2012 at 7:26

GoogleCodeExporter commented 8 years ago
I meant mockito 'will not work' sorry for the typo ;?

Original comment by szcze...@gradle.biz on 12 Jan 2012 at 7:27

GoogleCodeExporter commented 8 years ago
Please feel free to close this issue as Invalid.

Original comment by mburger313@gmail.com on 28 Jan 2012 at 12:05

GoogleCodeExporter commented 8 years ago

Original comment by brice.du...@gmail.com on 29 Jan 2012 at 8:43