2

私の Java コードは 2 つのライブラリ A と B に依存しています

A は GoogleCollections に依存しています B は GoogleGuava r10 に依存しています。

Now when i build  my code everything works fine.But when i run i get following exception

java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.copyOf([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;
    at com.abc.Pqr$Builder.withXYZ(ExponentialBackoffRetryPolicy.java:329)

どうすればこの問題を解決できますか?

4

2 に答える 2

0

運が良ければ....依存する ImmutableList を含む GoogleCollections の最新バージョンのみを含めてください..

于 2012-11-02T07:38:27.623 に答える
0

Google Collections は廃止され、Guava に移動されました。A から除外します。Maven では、プロジェクトのPOMの依存関係タグの下にある除外タグを使用してそれを行います。

    <dependency>
        <groupId>org.project</groupId>
        <artifactId>library-a</artifactId>
        <version>[version]</version>
        <exclusions>
            <exclusion>
                <!-- whatever the correct values are -->
                <artifactId>google-collections</artifactId>
                <groupId>google-collections</groupId>
            </exclusion>
        </exclusions>
    </dependency>
于 2012-11-02T08:08:38.447 に答える