baba tschükk
baba tschükk

Reputation: 11

heroku change java version - deploy:war

im develop with the deploy:war plugin, now i get one error, that seems to be reasoned by java version.

i red this help about the system.propertys file and git add, but i dont want to use git, just deploy the final war. https://devcenter.heroku.com/articles/add-java-version-to-an-existing-maven-app

so how can i change the java version :D?

Would be appreciated if somone could help me out here,

regards

Upvotes: 0

Views: 474

Answers (2)

codefinger
codefinger

Reputation: 10318

You should use the Heroku Maven Plugin, which will allow you to configure the Java version in your pom.xml without the need for Git. You configuration might look something like this:

<build> <plugins> <plugin> <groupId>com.heroku.sdk</groupId> <artifactId>heroku-maven-plugin</artifactId> <version>0.3.4</version> <configuration> <appName>${heroku.appName}</appName> <jdkVersion>1.7</jdkVersion> </configuration> </plugin> </plugins> </build>

Then you would deploy with this command:

$ mvn heroku:deploy-war

I'm not sure what Java version you're using locally, but be aware that this plugin probably won't work with Java 6.

Upvotes: 1

Stephen C
Stephen C

Reputation: 718826

You can't just deploy the final WAR. It has (presumably) been built with Java 8 as the target platform. If so, it won't run on Java 8 or earlier. You will be get fatal exceptions at start up.

If the instructions say that you need to checkout and build from source ... then that is what you need to do.


... but i dont want to use git

If you really, really don't want to use git, you could hire a consultant to do the work for you. :-)


so how can i change the java version

If you are asking if there is some way to tweak a WAR file, then AFAIK there isn't one. In fact, it is not the WAR file per se that is the issue. Rather, it is the "magic number" in each of the ".class" files that gives the classfile minor version number. Even if you could rewrite the minor version number, there is no guarantee that the tweaked classes would work as expected on a Java 7 JVM.

Upvotes: 0

Related Questions