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...
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
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
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
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<webjars-bootstrap.version>4.1.3</webjars-bootstrap.version>
<webjars-jquery-ui.version>1.12.1</webjars-jquery-ui.version>
<webjars-jquery.version>3.3.1-1</webjars-jquery.version>
<java.version>${java.version}</java.version>
<maven.compiler.source>${versions-maven-plugin.version}</maven.compiler.source>
<maven.compiler.target>${versions-maven-plugin.version}</maven.compiler.target>
</properties>
Related
I have issue deploy project java. i configed pom.xml version jar 11 and mvn 3.8.1. I build success project in local so when i deployed in heroku. What I need to do?
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.8.4/plexus-compiler-javac-2.8.4.jar (21 kB at 211 kB/s)
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 149 source files to /tmp/build_740f92f8/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.581 s
[INFO] Finished at: 2022-10-14T02:29:49Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project NCKHSV: Fatal error compiling: invalid flag: --release -> [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/MojoExecutionException
! 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
The problem is heroku currently using Java 8: Heroku Java versions
The indicator is this line:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project NCKHSV: Fatal error compiling: invalid flag: --release -> [Help 1]
I've encountered this problem when building maven application with target is Java 11 but running JDK is Java 8. I can't help with heroku since I haven't used it yet
At heroku you could really use the configurations in your pom.xml below,
please look carefully. :)
please check maven-plugin mentioned in pom.xml under <project>
I have something like this below.
...
<packaging>maven-plugin</packaging>
</project>
Futher more please check this plugin you could replace the below plugin code and modify as per your need. It can be added under build->plugins->THIS_PLUGIN
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.4</version>
<configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>default-descriptor</id>
<phase>process-classes</phase>
</execution>
<execution>
<id>help-descriptor</id>
<phase>process-classes</phase>
</execution>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
Also please add the below dependency in your pom.xml, under ```dependencies-> THIS DEPENDENCY
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.4</version>
</dependency>
I hope, it helps!
I've been searching a solution for hours, couldn't even find 1 post about maven compilation to 1.16
I recently decided to one of my projects from java 8 to 16, so I installed 16 JDK and changed my build section(in pom.xml) accordingly:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.16</source> //used to be 1.8
<target>1.16</target> //used to be 1.8
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
But I get the following error when I try to install:
[INFO] Total time: 0.628 s
[INFO] Finished at: 2021-08-03T22:40:27+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project employeme: Fatal error compiling: error: invalid target release: 1.16 -> [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/MojoExecutionException
It's not 1.16, it's 16.
You don't have to configure the maven-compiler-plugin.
You can use the new release option.
<properties>
<maven.compiler.release>16</maven.compiler.release>
</properties>
I ran into a similar issue despite the fact that my settings were
<source>16</source> //used to be 8
<target>16</target> //used to be 8
The real insight came up when I ran
mvn --version
as this one pointed out I was running a current maven with JDK 11.
The solution was to change JAVA_HOME to point to my JDK 16 installation before running maven.
im trying to upload my discord bot project to Heroku using Git bash
My project is java 10 and im using Maven but i get this error :
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project bot_discord: Fatal error compiling: invalid flag: --release -> [Help 1]
remote: [ERROR]
remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote: [ERROR]
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
remote:
remote: ! ERROR: Failed to build app with Maven
remote: We're sorry this build is failing! If you can't find the issue in application code,
remote: please submit a ticket so we can help: https://help.heroku.com/
remote:
remote: ! Push rejected, failed to compile Java app.
remote:
remote: ! Push failed
i think i need to add something to my Pom.xml but i dont understand what to add !
my 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>
<groupId>kino.bot</groupId>
<artifactId>bot_discord</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Bot Ryo</name>
<description>Mon bot</description>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>10</release>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.7.1_422</version>
</dependency>
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
</dependency>
</dependencies>
</project>
what do i need to add to my pom.xml ?
Ensure that you have system.properties file in the root directory of your repository with the following contents:
java.runtime.version=10
For more info see the Heroku documentation on Java versions
The -release argument is supported only since Java9 (https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html). Make sure your maven installation is using at least Java9.
Try using version 3.8.0 instead of 3.7.0. Also make sure your JAVA_HOME is set to your Java 8 installation. See this link
There's another option instead of adding the properties file in the repo location.
You can add this code in POM.xml:
<properties>
<java.version>1.8.0_171</java.version>
</properties>
Remove <release>10</release> from pom.xml and add system.properties in resources with content java.runtime.version=10. It should work with jdk 10. Or you can change the JDK as per your need.
I am new to Maven and I am trying to create a JAR out of a HelloWorld program.
I have done the classpath setting:
This is the pom.xml file:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo</groupId>
<artifactId>custom-project</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0</version>
<name>custom-project Maven Mojo</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
When I trigger mvn package command, I am getting this error:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.700 s
[INFO] Finished at: 2018-04-13T12:25:12+05:30
[INFO] Final Memory: 9M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project custom-project: Compilation f
ailure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[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
JAVA_HOME is already set as C:\Program Files\Java\jdk1.8.0_121\bin in classpath. Please suggest how to resolve this issue.
Your JAVA_HOME is set to a JRE not to a JDK. The JRE does not include the Java Compiler, so set JAVA_HOME to a JDK and it should work
Also you can goto your project properties-> Libraries-> add Library -> JRE system Library -> Alternate JRE -> Add.
and then you choose your JDK path from your system and apply.
Make sure to remove JRE From project library.
In my case, this works well.
You need to tell java what class to run. Depending on the maven plugin you use the ways might be different. This link shows how it can be done with the help of the maven-assembly-plugin https://stackoverflow.com/a/45902851/6825678
I am getting the following error while building a .war using mcn clean package with Apache Maven. Can some one give me a way to resolve it? Thanks.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.593s
[INFO] Finished at: Thu Sep 05 22:35:10 GMT+05:30 2013
[INFO] Final Memory: 13M/24M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.0:compile (default) on project application: Compiler errors :
[ERROR] error at import javax.annotation.PreDestroy;
[ERROR] ^^^^^^^^^^^^^^^
[ERROR] C:\Documents and Settings\User\My Documents\application\application\src\main\java\com\Service\MyService.java:13:0::0 The import javax.annotation cannot be resolved
[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/MojoExecutionException
Does your pom.xml set the Java Compiler version?
Some (all?) versions of maven-compiler assume the Java 1.4 compiler... which of course causes issues since Annotations were new in Java 1.5.
You can force it to Java 7 by including a plugin block for maven-compiler-version in your project's pom.xml and set its source and target properties... something like this:
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]
</project>
Download JSR305 from here to fix the problem.