groovyとJerseyClientを一緒に使おうとするとIncompatibleClassChangeErrorが発生する

groovy と Jersey Client を一緒に使おうとすると、実行時に `IncompatibleClassChangeError` が発生した。

```text:
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.MethodVisitor, but class was expected
	at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.genConstructor(CallSiteGenerator.java:141)
	at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.genStaticMetaMethodSite(CallSiteGenerator.java:196)
	at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.compileStaticMethod(CallSiteGenerator.java:239)
	at org.codehaus.groovy.reflection.CachedMethod.createStaticMetaMethodSite(CachedMethod.java:285)
	at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.createStaticMetaMethodSite(StaticMetaMethodSite.java:111)
（以下略）
```

[Solving asm conflicts after upgrading to Groovy 2.1 - Jayway](http://www.jayway.com/2013/04/12/solving-asm-conflicts-after-upgrading-to-groovy-2-1/) このページによると、 `asm` のバージョンが jersey と groovy とで競合しているのが原因ぽい。

```text:
>gradle dependencies
runtime - Runtime classpath for source set 'main'.
+--- org.glassfish.jersey.core:jersey-client:2.5.1
|    +--- org.glassfish.jersey.core:jersey-common:2.5.1
|    |    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    |    +--- javax.annotation:javax.annotation-api:1.2
|    |    +--- com.google.guava:guava:14.0.1
|    |    +--- org.glassfish.hk2:hk2-api:2.2.0-b21
|    |    |    +--- javax.inject:javax.inject:1
|    |    |    \--- org.glassfish.hk2:hk2-utils:2.2.0-b21
|    |    |         \--- javax.inject:javax.inject:1
|    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0-b21
|    |    +--- org.glassfish.hk2:hk2-locator:2.2.0-b21
|    |    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0-b21
|    |    |    +--- org.glassfish.hk2.external:asm-all-repackaged:2.2.0-b21 ★ここと
|    |    |    +--- org.glassfish.hk2:hk2-api:2.2.0-b21 (*)
|    |    |    +--- org.glassfish.hk2:hk2-utils:2.2.0-b21 (*)
|    |    |    \--- org.glassfish.hk2.external:cglib:2.2.0-b21
|    |    \--- org.glassfish.hk2:osgi-resource-locator:1.0.1
|    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    +--- com.google.guava:guava:14.0.1
|    +--- org.glassfish.hk2:hk2-api:2.2.0-b21 (*)
|    +--- org.glassfish.hk2.external:javax.inject:2.2.0-b21
|    \--- org.glassfish.hk2:hk2-locator:2.2.0-b21 (*)
\--- org.codehaus.groovy:groovy:2.0.7
     +--- antlr:antlr:2.7.7
     +--- org.ow2.asm:asm-tree:4.0 ★この辺が競合してる
     |    \--- org.ow2.asm:asm:4.0
     +--- org.ow2.asm:asm-commons:4.0
     |    \--- org.ow2.asm:asm-tree:4.0 (*)
     +--- org.ow2.asm:asm:4.0
     +--- org.ow2.asm:asm-util:4.0
     |    \--- org.ow2.asm:asm-tree:4.0 (*)
     \--- org.ow2.asm:asm-analysis:4.0
          \--- org.ow2.asm:asm-tree:4.0 (*)
```

jersey が `org.glassfish.hk2.external:asm-all-repackaged:2.2.0-b21` に依存してて、 groovy が `org.ow2.asm:asm:4.0` に依存してる。
（`jersey-common` が `asm` に依存しているから、たぶん Client じゃなくてもこの問題は発生すると思われる）

jersey の方の `asm` を推移的な依存関係の管理から外すと解決する。

```groovy:build.gradle
dependencies {
    compile ('org.glassfish.jersey.core:jersey-client:2.5.1') {
        exclude module: 'asm-all-repackaged'
    }
    compile 'org.codehaus.groovy:groovy:2.0.7'
}
```

```text:
>gradle dependencies
runtime - Runtime classpath for source set 'main'.
+--- org.glassfish.jersey.core:jersey-client:2.5.1
|    +--- org.glassfish.jersey.core:jersey-common:2.5.1
|    |    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    |    +--- javax.annotation:javax.annotation-api:1.2
|    |    +--- com.google.guava:guava:14.0.1
|    |    +--- org.glassfish.hk2:hk2-api:2.2.0-b21
|    |    |    +--- javax.inject:javax.inject:1
|    |    |    \--- org.glassfish.hk2:hk2-utils:2.2.0-b21
|    |    |         \--- javax.inject:javax.inject:1
|    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0-b21
|    |    +--- org.glassfish.hk2:hk2-locator:2.2.0-b21
|    |    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0-b21 ★"asm-all-repackaged" が消えてる
|    |    |    +--- org.glassfish.hk2:hk2-api:2.2.0-b21 (*)
|    |    |    +--- org.glassfish.hk2:hk2-utils:2.2.0-b21 (*)
|    |    |    \--- org.glassfish.hk2.external:cglib:2.2.0-b21
|    |    \--- org.glassfish.hk2:osgi-resource-locator:1.0.1
|    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    +--- com.google.guava:guava:14.0.1
|    +--- org.glassfish.hk2:hk2-api:2.2.0-b21 (*)
|    +--- org.glassfish.hk2.external:javax.inject:2.2.0-b21
|    \--- org.glassfish.hk2:hk2-locator:2.2.0-b21 (*)
\--- org.codehaus.groovy:groovy:2.0.7
     +--- antlr:antlr:2.7.7
     +--- org.ow2.asm:asm-tree:4.0
     |    \--- org.ow2.asm:asm:4.0
     +--- org.ow2.asm:asm-commons:4.0
     |    \--- org.ow2.asm:asm-tree:4.0 (*)
     +--- org.ow2.asm:asm:4.0
     +--- org.ow2.asm:asm-util:4.0
     |    \--- org.ow2.asm:asm-tree:4.0 (*)
     \--- org.ow2.asm:asm-analysis:4.0
          \--- org.ow2.asm:asm-tree:4.0 (*)
```

#参考
- [Solving asm conflicts after upgrading to Groovy 2.1 - Jayway](http://www.jayway.com/2013/04/12/solving-asm-conflicts-after-upgrading-to-groovy-2-1/)
- [第50章 依存関係の管理 | Gradle Users Guide](http://gradle.monochromeroad.com/docs/userguide/dependency_management.html)
- [ModuleDependency (Gradle API 1.11-20131203060736+0000)](http://gradle.monochromeroad.com/docs/javadoc/org/gradle/api/artifacts/ModuleDependency.html)