0

При попытке задеплоить телеграмм бота на heroku выдает ошибку

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project TestBot: Compilation failure remote:
[ERROR] /tmp/build_31e640807cc4c7dde699ecf0c146d90e/src/main/java/com/bot/Main.java:[68,52] diamond operator is not supported in -source 1.5 remote:
[ERROR] (use -source 7 or higher to enable diamond operator)

Строка 68:

List keyboard = new ArrayList<>();

pom.xml

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

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
    <groupId>org.example</groupId>
    <artifactId>TestBot</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>appassembler-maven-plugin</artifactId>
                <version>1.1.1</version>
                <configuration>
                    <assembleDirectory>target</assembleDirectory>
                    <source>1.8</source>
                    <target>1.8</target>
                    <programs>
                        <program>
                            <mainClass>com.bot.Main</mainClass>
                            <name>workerBot</name>
                        </program>
                    </programs>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <!-- https://mvnrepository.com/artifact/org.telegram/telegrambots -->
    <dependencies>
        <dependency>
            <groupId>org.telegram</groupId>
            <artifactId>telegrambots</artifactId>
            <version>4.9</version>
        </dependency>
    </dependencies>

    
</project>

1 ответ 1

1

Попробуйте добавить это в properties

 <properties>
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
 </properties>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.