vbauer / yandex-translate-api

A simple REST client library for Yandex.Translate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoClassDefFoundError error occurs

jfenuk opened this issue · comments

Steps to reproduce:

  • Create empty Maven project with the following pom.xml:


4.0.0

<groupId>com.acme</groupId>
<artifactId>yandex-translate</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
    <dependency>
        <groupId>com.github.vbauer</groupId>
        <artifactId>yandex-translate-api</artifactId>
        <version>1.2.2</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
  • Execute the following peace of code:

     api.detectionApi().detect("Hello, World!");
    
  • The following error occurs:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/GsonBuilder
at com.github.vbauer.yta.service.transport.impl.DataConverterImpl.createConverter(DataConverterImpl.java:59)
at com.github.vbauer.yta.service.transport.impl.DataConverterImpl.(DataConverterImpl.java:44)
at com.github.vbauer.yta.service.basic.ApiContext.of(ApiContext.java:80)
at com.github.vbauer.yta.service.YTranslateApiImpl.(YTranslateApiImpl.java:58)

@jfenuk Thank you for the found bug. I've just written to author of ru.vyarus.java-lib & ru.vyarus.pom Gradle plugins. I hope he will fix this problem in the nearest future.

JFYI: You can use workaround: add dependency on com.google.code.gson:gson:2.6.2 in you project.

Fixed in the version 1.2.3.