如何在 jitpack 中发布一个 java 库?我已经尝试过但没有用

How to publish a java library in jitpack? I have tried an attempt but its not working

我已经为 java 应用程序准备了一个 java 库。我已经完成编码,没有任何错误。通过参考一些网站,我尝试将其发布在 github 和 jitpack 上。但是当我 "look up".

时它显示了一些错误
*
WARNING:
Gradle 'install' task not found. Please add the 'maven' or 'android-maven' plugin.
See the documentation and examples: https://jitpack.io/docs/


Looking for android-library
Looking for com.android.application
Adding maven plugin
Running: ./gradlew clean -Pgroup=com.github.Sivakumar00 -Pversion=EasyCurrencyConverter-1.0.1 -xtest install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all -Dhttps.protocols=TLSv1.2
:clean UP-TO-DATE
:compileJava/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:5: error: package org.apache.http does not exist
import org.apache.http.HttpEntity;
                      ^
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:6: error: package org.apache.http does not exist
import org.apache.http.HttpHeaders;
                      ^
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:7: error: package org.apache.http does not exist
import org.apache.http.HttpResponse;
                      ^
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:8: error: package org.apache.http.client does not exist
import org.apache.http.client.HttpClient;
                             ^
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:9: error: package org.apache.http.client.methods does not exist
import org.apache.http.client.methods.HttpGet;
                                     ^
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:10: error: package org.apache.http.impl.client does not exist
import org.apache.http.impl.client.DefaultHttpClient;
                                  ^
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:11: error: package org.apache.http.util does not exist
import org.apache.http.util.EntityUtils;
                           ^
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:12: error: package org.json does not exist
import org.json.JSONObject;
               ^
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:25: error: cannot find symbol
        HttpClient client = new DefaultHttpClient();
        ^
  symbol:   class HttpClient
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:25: error: cannot find symbol
        HttpClient client = new DefaultHttpClient();
                                ^
  symbol:   class DefaultHttpClient
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:26: error: cannot find symbol
        HttpGet httpGet = new HttpGet(API_ENDPOINT + reqString + "&compact=ultra");
        ^
  symbol:   class HttpGet
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:26: error: cannot find symbol
        HttpGet httpGet = new HttpGet(API_ENDPOINT + reqString + "&compact=ultra");
                              ^
  symbol:   class HttpGet
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:27: error: cannot find symbol
        httpGet.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
                          ^
  symbol:   variable HttpHeaders
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:28: error: cannot find symbol
        HttpResponse response = null;
        ^
  symbol:   class HttpResponse
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:35: error: cannot find symbol
        HttpEntity entity = response.getEntity();
        ^
  symbol:   class HttpEntity
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:38: error: cannot find symbol
            responseString = EntityUtils.toString(entity, "UTF-8");
                             ^
  symbol:   variable EntityUtils
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:42: error: cannot find symbol
        JSONObject jsonObject = new JSONObject(responseString);
        ^
  symbol:   class JSONObject
  location: class EasyCurrency
/home/jitpack/build/src/main/java/com/easycurrency/EasyCurrency.java:42: error: cannot find symbol
        JSONObject jsonObject = new JSONObject(responseString);
                                    ^
  symbol:   class JSONObject
  location: class EasyCurrency
18 errors
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
2 actionable tasks: 1 executed, 1 up-to-date
EXIT_CODE=1
2018-06-28T08:36:56.191034164Z
Exit code: 1
No build artifacts found*

I have build artifact and imported all library which i used in my library. But its showing error on "import" line. Kindly say me a solution or please tell me the step by step flow of publishing java library.

If u find difficulty in seeing error log. visit: https://notepad.pw/errorlog

注意:其 java 库。我还没有做到 android..

Build.gradle 文件

plugins {
    id 'java'
}

group='com.github.jitpack'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
   maven{url 'https://jitpack.io'}
}

dependencies {

    testCompile group: 'junit', name: 'junit', version: '4.12'

    compile 'org.apache.httpcomponents:httpclient:4.5'

    compile 'org.json:json:20160212'
}

我找到了我的问题的解决方案。我已经在 "maven" 和 "gradle" 中导入了依赖项。而且我在导入依赖项的版本中犯了一个错误。非常抱歉,感谢您花时间回答我的问题。

    plugins {
    id 'java'
}

group='com.github.jitpack'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven{url 'https://jitpack.io'}
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile 'org.eclipse.jgit:org.eclipse.jgit.http.apache:3.7.1.201504261725-r'
    compile 'org.json:json:20171018'
}