Подключитесь к JIRA, используя JAVA - PullRequest
0 голосов
/ 18 февраля 2020

Я пытаюсь подключиться к JIRA, используя jira- java -клиент (предоставлен atlassian).

ДЕТАЛИ КОДА: Вот мой файл build.gradle (уровень приложения)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.appautomation"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    testImplementation group: 'junit', name: 'junit', version: '4.12'
    testImplementation group: 'io.appium', name: 'java-client', version: '6.1.0'
    testImplementation group: 'org.testng', name: 'testng', version: '6.14.3'

    // https://mvnrepository.com/artifact/com.atlassian.jira/jira-rest-java-client-core
    implementation group: 'com.atlassian.jira', name: 'jira-rest-java-client-core', version: '5.1.1-e0dd194'
    // https://mvnrepository.com/artifact/com.atlassian.jira/jira-rest-java-client-api
    implementation group: 'com.atlassian.jira', name: 'jira-rest-java-client-api', version: '5.1.1-e0dd194'

    // https://mvnrepository.com/artifact/io.atlassian.fugue/fugue
    compileOnly group: 'io.atlassian.fugue', name: 'fugue', version: '4.7.2'

    // https://mvnrepository.com/artifact/org.slf4j/slf4j-api
    //implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.0-alpha1'
}

А это мой Java код для подключения и извлечения проблемы

import com.atlassian.jira.rest.client.api.JiraRestClient;
import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory;
import java.net.URI;
import java.net.URISyntaxException;
import io.atlassian.util.concurrent.Promise;
import utils.LogUtils;

public class JiraIntegration {
    private final String USERNAME = EMAIL;
    private final String PASSWORD = API_TOKEN;

    public void jiraConnectionSetup() throws URISyntaxException {
        try {
            final URI jiraServerURI = new URI("https://jirajifflenow.atlassian.net/");
            final JiraRestClient jiraRestClient = new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraServerURI, USERNAME, PASSWORD);
            Promise issuePromise = jiraRestClient.getIssueClient().getIssue("MOBILE-2773");
            LogUtils.setInfo("Here is you Issue" + issuePromise);
        } catch (Exception e) {
            LogUtils.setError("Error happened" + e);
            e.printStackTrace();
        }
    }
}

ДЕТАЛИ ОШИБКИ:

Первоначально только с jira-rest-java-client-core зависимостью я получаю ошибку ниже:

Caused by: java.lang.ClassNotFoundException: io.atlassian.fugue.Suppliers
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 8 more

, для которой я добавил fugue зависимость (как предложено в сообществе), но затем я получаю ошибку ниже:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.getRegistry(ApacheAsyncHttpClient.java:233)
    at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.<init>(ApacheAsyncHttpClient.java:158)
    at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.<init>(ApacheAsyncHttpClient.java:102)
    at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.doCreate(DefaultHttpClientFactory.java:61)
    at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.create(DefaultHttpClientFactory.java:36)
    at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:65)
    at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:36)
    at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithBasicHttpAuthentication(AsynchronousJiraRestClientFactory.java:42)
    at JiraIntegration.jiraConnectionSetup(JiraIntegration.java:18)
    at SuiteBuilder.main(SuiteBuilder.java:25)
Caused by: java.lang.RuntimeException: Stub!
    at org.apache.http.conn.ssl.AbstractVerifier.<init>(AbstractVerifier.java:57)
    at org.apache.http.conn.ssl.AllowAllHostnameVerifier.<init>(AllowAllHostnameVerifier.java:54)
    at org.apache.http.nio.conn.ssl.SSLIOSessionStrategy.<clinit>(SSLIOSessionStrategy.java:67)
    ... 10 more

Я даже добавил slf4j-api зависимость, но все еще та же ошибка.

Я что-то здесь упускаю? Позвольте мне знать, если понадобится больше деталей.

...