How to resolve compileJava errors during heroku deployment? - spring-boot

I worked as follows to deploy Intellij Spring Boot using gradle on heroku. I proceeded from the directory containing the source files.
> git init
> git add .
> git commit -m "first commit"
> heroku create
> git push heroku master
However, the following error occurred during the push process.
What went wrong: Execution failed for task ':compileJava'.
invalid source release: 11
After the problem occurred, a file called system.properties was also created in the source file and the following input was also entered.
java.runtime.version=11
But it is still unresolved. How do I solve this problem?

First you have to ensure your local development and your deployed instance are using the same version.
You specified a version with system.properties with content java.runtime.version=11 but haven't provided an image of the updated log. The log still says you are installing JDK 1.8.
Furthermore you should specify a Java version that is currently being supported. You can find the versions here: https://devcenter.heroku.com/articles/java-support#supported-java-versions
Java 7 - 1.7.0_302
Java 8 - 1.8.0_292
Java 11 - 11.0.11
Java 13 - 13.0.7
Java 15 - 15.0.3
Java 16 - 16.0.1

I've just face this problem following a course. Solve it by change the sourceCompatibility='17'(on my file) to '1.8' on my built.gradle file change sourceCompatibility='1.8' on build.gradle file
and change the Gradle JMV on setting and JKD on project structure to 1.8.
enter image description here
duno if the last change anything, but worked for me.

Related

how to change gradle version in nativescript

I'm confused as how to change a specific configuration somewhere to determine the version of my gradle, in a nativescript project.
My workspace is created with nx and when I try to run the app with npx nx run test:android I get this error message:
Could not compile settings file '<somepath>\start\learn\apps\nativescript-test\platforms\android\settings.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 62
Based on my research if I need to resolve this issue I need to either update my gradle version or downgrade my JDK version. The solution I'm searching for is to how to specify my gradle version.
Thanks in advance.
based on my understanding version of gradle is defined by #nativescript/android package (read its README.md), so if updating the #nativescript/android doesn't help do the next steps
1- install jdk 18 -> because its the first version that supports major version 62
2- add JAVA_HOME to env vars
3- in platform/gradle.properties add org.gradle.java.home=C:\\Program Files\\Java\\jdk-18.0.1 (because in my case gradle didn't read form JAVA_HOME)
4- change platform/gradle-wrapper gradle version to 7.4.2
5- in platform/build.gradle do this: replace whatever version of plugin to classpath 'com.android.tools.build:gradle:7.2.0'

Sync error while trying to build project in IntelliJ

Getting the following sync error while trying to build my first helloWorld program in IntelliJ.
I've installed IntelliJ for the first time on my computer running Windows 10.
Could not open init generic class cache for initialization script 'C:\Users\nikhils\AppData\Local\Temp\wrapper_init5.gradle' (C:\Users\nikhils\.gradle\caches\6.6.1\scripts\2xaig2b083uxqwleg0fdntova).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
Change project and Gradle JDK to the supported version (8—15). Current Gradle release versions do not support Java 16. You would need Gradle 7 if you want to use Java 16.
The easiest way would be to create a new project with Java 11.
Also note that full Java 16 support will be available starting from IntelliJ IDEA 2021.1 release (current release version is 2020.3.3).
See https://www.jetbrains.com/idea/nextversion/ if you want to give it a try.

Fail to build under circle-ci / gradle / lombok -- decorated class LombokPlugin / FindBugExtension

I have some code that built last week on both my desktop and Circle-CI, but today it built only on my desktop but not on Circle-CI. The error message was
* What went wrong:
An exception occurred applying plugin request [id: 'io.freefair.lombok', version: '4.1.2']
> Failed to apply plugin [id 'io.freefair.lombok']
> Could not create plugin of type 'LombokPlugin'.
> Could not generate a decorated class for class io.freefair.gradle.plugins.lombok.LombokPlugin.
> org/gradle/api/plugins/quality/FindBugsExtension
Does this message ring a bell with someone? (By the way, I also tried upgrading io.freefair.lombok to 4.1.3 but that didn't help)
Thanks!
I found a solution -- switch to use gradle wrapper (instead of the gradle deployed on CircleCI), and also make the wrapper executable.
To do the former, edit the file config.yml used by CircleCI
To do the latter, use the following git command:
$ git update-index --chmod=+x ./gradlew
By the way, in the error message on CircleCI, it mentioned Gradle 7.0 that got me thinking that may be there was a recent version upgrade on the platform, and hence the idea of the fix.

SonarQube startup Error: log4j2 could not find a logging implementation. Please add log4j2 to the filepath

I resolved this issue, I did it by following the instructions found here:
Elasticsearch installation : Error missing 'server' JVM at ...jvm.dll
I was using SonarQube fine the day before, but today when I tried to start the program I'm getting a error.
I have not changed anything on SonarQube as far as I know, I did made a successful connection with SonarQube to Jenkins. But if I remember correctly, I didn't had to install/change files for SonarQube for this(I just made a project, and generated a user login token for Jenkins). Also, I'm sure I'm using the "vanilla" version of SonarQube.
Download and install Java
Go to
c:/program files/java/jre/bin
and create a folder called "server"
Now go into the
c:/program files/java/jre/bin/client
and copy all data of this folder to
c:/program files/java/jre/bin/Server
updating/reinstalling the target jre (jre-8u181-windows-x64 for sonarqube 6.7.x) resolved this for me
I copied these jar in this route and it worked:
path: sonarqube-6.7/lib
log4j-api
log4j-core
This is a side effect; your have a JRE in your Windows PATH.
You need a JDK in your %PATH% // see previous error log
jvm 1 | Error: missing `server' JVM at `C:\Program Files (x86)\Java\jre1.8.0_191\bin\server\jvm.dll'.
jvm 1 | Please install or use the JRE or JDK that contains these missing components.
Used JDK 15, had same issue
Installed OpenJDK 11 instead (https://jdk.java.net/java-se-ri/11)
opened "[path to sonarqube folder]\conf\wrapper.conf"
replaced "wrapper.java.command=java"
with "wrapper.java.command=C:\Program Files\Java\jdk-11\bin\java.exe"
worked for me.

Unsupported method: GradleProject.getBuildScript()

I am getting this error while importing an adt project(after exporting and creating gradle file) into Android Studio on mac os x.
The android-studio version is 3.6 (latest) and the gradle version is 1.8 (latest).
The error shows up as:
Unsupported method: GradleProject.getBuildScript(). The version of
Gradle you connect to does not support that method. To resolve the
problem you can change/upgrade the target version of Gradle you
connect to. Alternatively, you can ignore this exception and read
other information from the model.
Consult IDE log for more details (Help | Show Log)
I have no idea where to look for IDE logs...
I was getting a similar error today opening a project after upgrading to Android Studio 0.3.6. Here is what I had to change to get it working again for me.
Changed the following line in gradle-wrapper.properties from gradle-1.6-bin.zip to gradle-1.8-bin.zip
distributionUrl=http://services.gradle.org/distributions/gradle-1.8-bin.zip
Also changed the following line in build.gradle from 0.5.+ to 0.6.+
classpath 'com.android.tools.build:gradle:0.6.+'
In Windows, gradle-wrapper.properties is located at \project folder\gradle\wrapper\gradle-wrapper.properties
build.gradle is located at \project folder\module folder\build.gradle
The Files that Needed changed are highlighted in the project explorer screen shot below.
After those changes I sync'd the project with the gradle files and then could build and test.
Hope that helps.
Note that you should use default or customizable gradle wrapper:

Resources