2

我已经为 java 应用程序准备了一个 java 库。我已经完成了编码,没有任何错误。通过引用一些网站,我尝试在 github 和 jitpack 上发布它。但是当我“查找”时它显示了一些错误。

*
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*

我已经构建了工件并导入了我在库中使用的所有库。但它在“导入”行上显示错误。请告诉我一个解决方案,或者请告诉我发布 java 库的分步流程。

如果您在查看错误日志时发现困难。访问:https ://notepad.pw/errorlog

注意:它的 java 库。我还没有为android..

构建.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'
}
4

1 回答 1

0

我找到了我的问题的解决方案。我已经在“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'
}
于 2018-06-28T11:28:51.377 回答