Компилирую проект через мавен на удаленном сервере и вылезает ошибка:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project NewVkBot: Compilation failure
[ERROR] /var/www/likekey/data/newBot/NewVkBot/src/main/java/ru/likekey/vkbot/vk/longpool/LongPollJsonParser.java:[39,45] incompatible types: ru.likekey.vkbot.vk.longpool.MessageFromJson cannot be converted to ru.likekey.vkbot.vk.longpoll.MessageFromJson
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
При компиляции на пк в Intellij никаких проблем нет.
Pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.likekey.vkbot</groupId>
<artifactId>NewVkBot</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.28.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.23</version>
</dependency>
<dependency>
<groupId>com.vk.api</groupId>
<artifactId>sdk</artifactId>
<version>1.0.7</version>
</dependency>
<dependency>
<groupId>com.qiwi</groupId>
<artifactId>bill-payments-java-sdk</artifactId>
<version>1.5.0</version>
</dependency>
</dependencies>
</project>
MessageFromJson.java:
public class MessageFromJson {
private int id;
private int fromId;
private String text;
public MessageFromJson(int id, int fromId, String text) {
this.id = id;
this.fromId = fromId;
this.text = text;
}
public int getId() {
return id;
}
public int getFromId() {
return fromId;
}
public String getText() {
return text;
}
}
LongPollUrlParser.java:
public class LongPollJsonParser {
LongPollUrlHandler longPollUrlHandler = new LongPollUrlHandler();
LongPollInfo longPollInfo = new LongPollInfo();
private String URL = longPollUrlHandler.longPollUrlHandler();
public LongPollJsonParser() throws ClientException, ApiException, IOException {
}
private static Float getTime() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("ss.SS");
return Float.parseFloat(simpleDateFormat.format(new Date().getTime()));
}
public void startParsing() throws ClientException, ApiException, IOException {
while (true) {
JsonElement jsonParser = new JsonParser().parse(URL);
JsonObject json = jsonParser.getAsJsonObject();
try {
json = json.getAsJsonArray("updates").get(0).getAsJsonObject();
String type = json.get("type").getAsString();
json = json.getAsJsonObject("object");
if (type.equals("message_new")) {
MessageHandler messageHandler = new MessageHandler(new MessageFromJson(
json.get("id").getAsInt(),
json.get("user_id").getAsInt(),
json.get("body").getAsString()
));
new Thread(messageHandler).start();
} else if (type.equals("message_event")) {
MessageHandler messageHandler = new MessageHandler(new MessageFromJson(
json.get("conversation_message_id").getAsInt(),
json.get("user_id").getAsInt(),
json.getAsJsonObject("payload").get("button").getAsString()
));
new Thread(messageHandler).start();
}
} catch (IndexOutOfBoundsException e) {
} catch (NullPointerException e) {
} catch (Exception e) {
}
longPollInfo.longPollUpdate();
}
}
}
Ошибка возникает на месте, где создается объект MessageFromJson