我已经为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上做到这一点。
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'
}
答案 0 :(得分: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'
}