我从Maven下载了一个库,但是需要覆盖其中一个文件中的单个字符串,所以我进入了IntelliJ的Maven Projects选项卡,并在C:\Users\mnxe\Documents\parse4j-master\pom.xml
的pom.xml文件中手动添加了该项目。我现在可以从项目文件夹结构中访问.java文件:
我做了更改,将API_ENDPOINT替换为我需要的网址(仅供参考,https://api.parse.com不再存在):
package org.parse4j;
public class ParseConstants {
public static final String API_ENDPOINT = "https://parseapi.back4app.com";
public static final String API_VERSION = "1";
public static final String HEADER_CONTENT_TYPE = "Content-Type";
public static final String HEADER_APPLICATION_ID = "X-Parse-Application-Id";
public static final String HEADER_REST_API_KEY = "X-Parse-REST-API-Key";
public static final String HEADER_MASTER_KEY = "X-Parse-Master-Key";
public static final String HEADER_SESSION_TOKEN = "X-Parse-Session-Token";
public static final String CONTENT_TYPE_JSON = "application/json";
public static final String FIELD_OBJECT_ID = "objectId";
public static final String FIELD_CREATED_AT = "createdAt";
public static final String FIELD_UPDATED_AT = "updatedAt";
public static final String FIELD_SESSION_TOKEN = "sessionToken";
public static int MAX_PARSE_FILE_SIZE = 10485760;
}
我的项目现在应该有效,但我得到了一个例外:
3306 [main] ERROR org.parse4j.ParseObject - Request failed.
Exception in thread "main" org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
at org.json.JSONObject.<init>(JSONObject.java:194)
at org.json.JSONObject.<init>(JSONObject.java:321)
at org.parse4j.command.ParseResponse.getJsonObject(ParseResponse.java:83)
at org.parse4j.command.ParseResponse.getException(ParseResponse.java:71)
at org.parse4j.ParseObject.save(ParseObject.java:492)
at tmt.main(tmt.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
我感觉它仍然在我的主pom.xml中调用旧的依赖项:
<dependency>
<groupId>com.github.thiagolocatelli</groupId>
<artifactId>parse4j</artifactId>
<version>1.4</version>
</dependency>
我应该删除此依赖项吗?如果是这样,将新的本地修改后的类导入我的应用程序的语法是什么?
答案 0 :(得分:1)
以下是我建议的工作流程:
当然,1.4版固定版现在只存在于您自己的机器上(除非您将其部署到某些公司的Nexus / Artifactory)。