My pom.xml File :
<modelVersion>4.0.0</modelVersion> <groupId>TelegramBOT</groupId> <artifactId>TelegramBOT</artifactId> <version>0.0.1-SNAPSHOT</version> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <groupId>com.heroku.sdk</groupId> <artifactId>heroku-maven-plugin</artifactId> <version>3.0.2</version> <configuration> <release>13</release> <appName>TelegramBOT</appName> <processTypes> <web>java $JAVA_OPTS -cp target/classes:target/dependency/* Main</web> </processTypes> </configuration> </plugin> </plugins> </build> <dependencies> <!-- https://mvnrepository.com/artifact/org.telegram/telegrambots --> <dependency> <groupId>org.telegram</groupId> <artifactId>telegrambots</artifactId> <version>4.9</version> </dependency> </dependencies> </project>
This is The Build Of pom.xml But I am Not Able To Host In Heroku… Its Shows An Error
[INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 10.182 s [INFO] Finished at: 2020-06-28T11:59:51Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project TelegramBOT: Compilation failure: Compilation failure: [ERROR] /tmp/build_07ca4d72478d669dcc1d1150921b9882/src/com/TelegramBot/EraserHead/GameHandler.java:[17,60] diamond operator is not supported in -source 1.5 [ERROR] (use -source 7 or higher to enable diamond operator) [ERROR] /tmp/build_07ca4d72478d669dcc1d1150921b9882/src/com/TelegramBot/EraserHead/ImageGuess.java:[23,60] diamond operator is not supported in -source 1.5 [ERROR] (use -source 7 or higher to enable diamond operator) [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 ! ERROR: Failed to build app with Maven We're sorry this build is failing! If you can't find the issue in application code, please submit a ticket so we can help: https://help.heroku.com/ ! Push rejected, failed to compile Java app. ! Push failed
This The Heroku Console ….
But In Eclipse Console Its Says BUILD SUCCESSFUL!
I Can’t Figure Out What To Do … Do I Really Need To Create Procfile ???
Please Help… If You Need to See The Source Code Of My Program,
It Is There In My GitHub Account : https://github.com/saikat0326/Saikat-Telegram-BOT
Thanks In Advance…
2
Answers
it looks like the Maven Compiler plugin is using Java 5 (it should be using Java 6 by default), hence you get the build error
diamond operator is not supported in -source 1.5
Heroku supports various Java version (see Supported Java versions), you should just be able to set the target version in your POM file
The diamond operator – introduced in Java 1.7 – adds type inference and reduces the verbosity in the assignments.
Problem in your source code try to re-write it.
I had similar issu and my now looks like this