1

I'm trying to upload on heroku simple servlet with maven. Locally my servlet is working just fine but when i use:

git push heroku master

I get "BUILD FAILURE" with error message:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:
3.1:compile (default-compile) on project HelloServlet: Fatal error compiling: 
invalid target release: 1.7 -> [Help 1]

I changed everything to Java 1.7 in system variables, maven is running Java 1.7, javac version is 1.7?

Am I missing something here?

edit: my JAVA_HOME and error screenshot

enter image description here

enter image description here

psubsee2003
  • 8,563
  • 8
  • 61
  • 79
user2740217
  • 155
  • 1
  • 1
  • 8
  • Have you set the JAVA_HOME environment variable? If you have what does mvn -version show?. Possible duplicate of http://stackoverflow.com/questions/19891423/invalid-target-release-1-7 – coderplus Oct 26 '14 at 12:50
  • i have setted it all, mvn -version shows D:\workspace-STS\DrinkApp>mvn -version Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:1 0+02:00) Maven home: C:\Program Files\apache-maven-3.2.3 Java version: 1.7.0_71, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.7.0_71\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "windows" – user2740217 Oct 26 '14 at 12:57

2 Answers2

4

By default heroku apps run on OpenJDK 6.You have to add additional properties to make your app use Open JDK 7 on heroku.

Refer : https://devcenter.heroku.com/articles/add-java-version-to-an-existing-maven-app

coderplus
  • 5,793
  • 5
  • 34
  • 54
1

Did you set source and target configuration parameters of maven-compiler-plugin correctly?

http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

In your pom.xml:

<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>
gvlasov
  • 18,638
  • 21
  • 74
  • 110