Project won't compile in IntelliJ IDEA after adding Maven support because of complaints about the JDK version - maven

I'm using IntellJ 14.1.4 Community Edition
My project compiled fine before (I have it set up to use the Eclipse compiler)
But I tried to Mavenize it...
I added Maven via the Add Framework | Maven command
Now my problem is (still using the Eclipse Compiler)...
It gives me error messages like:
Error:(21, 78) java: '<>' operator is not allowed for source level below 1.7
Which leads me to suspect that it is not compiling to 1.8
However, I didn't change anything other than Mavenizing it
The Project SDK in IDEA is set to use 1.8
I did notice some setting about bytecode being 1.5.. but i tried to change that to 1.8 but still get this error message.
Anyone have any clue what's going on?

this was essentially the correct advice of course - in the comments, however I had been trying to do it for a long time both via maven-compiler-plugin and properties... to no success, even though I was refreshing Maven after making changes to pom.xml. Finally, I restarted the IDE .. and .. it works! I can compile..

Related

gradle-wrapper.properties not found after clean install intellij idea 2020.1.2 community edition on windows 10

Installed clean windows10(1607) and intellij idea(2020.1.2 community edition). When i create new gradle project
Invalid Gradle JDK configuration found. Open Gradle Settings
"gradle-wrapper.properties not found".
How can I fix it?
Install gradle 6.7
sdk install gradle 6.7
brew install gradle
Go to IntelliJ and set gradle version:
On File >> Settings >> Build, Execution , Deployment >> Gradle
or
Preferences >> Gradle
In Use Gradke from specific the correct location
If IDEA is set to use the Gradle wrapper (as it is in your screenshot: "Use Gradle from:" is set to "gradle-wrapper.properties"), IDEA expects the following file structure:
Gradle wrapper JAR: [project root]/gradle/wrapper/gradle-wrapper.jar
Gradle wrapper properties: [project root]/gradle/wrapper/gradle-wrapper.properties
Gradle wrapper script: [project root]/gradlew.bat
If you are missing one of these three elements, IDEA will attempt to generate the wrapper by calling the gradle wrapper task. It will do this using the Gradle JDK, which may or may not be the project SDK (File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JVM).
I'm not sure how it selects the version of Gradle it uses - I only have 6.8.3 installed on my machine, and I had my wrapper properties set to 7.0-rc-1, yet somehow it used 6.7.0 when generating the wrapper.
I tried various options for clearing the cache, but did not get the result.
Openjdk-14 installed by default and does not work. From site adoptopenjdk.net install OpenJDK 11 (LTS). When creating the project, I chose 11 version. Then the program suggested updating gradle to version 6 and it worked.
I ran into this problem a while ago when I upgraded to intellij 2020.* The first time I created a new project there was no problem: gradle daemon did its work and the project was created with no problems.
In my case, the project would start a new gradle daemon, and attempt to build the project, would get rejected by windows Security, and nothing would happen, so intellij goes ahead and starts another (unsuccessful) daemon. Soon, I had 20+ gradle daemon processes running on my system, all of them doing nothing.
So, it looks like intellij has messed in enabling that it places the appropriate permissions it requires for these folders that it depends on to run properly. So, you need to manually give these permissions, and then things (should) work.
The real issue here is security on your machine: either a virus checker or the security software, Windows Security on Windows 10, for example. The first time you make a project, Intellij goes and produces a number of folders that they need access to.
However, once these folders are available, for whatever, intellij doesn't make sure to give itself access.
On windows 10, in AppData, you'll find several folders required by Intellij to produce, in my case, produce gradle projects.
Try finding the various folders that Intellij has produced on your system, and give them exceptions on your virus checker and on whatever firewall/security software programs that may block access.

Intellij issue resolving dependency for spring kotlin

Intellij is giving me errors all around for brand new kotlin/spring project and I cannot build or run the project from the IDE.
If I do it from the command line however, there are no issues and I can build and run the app.
'classpath' in 'org.gradle.api.artifacts.dsl.DependencyHandler' cannot be applied to '(groovy.lang.GString)'
'apply' in 'org.gradle.api.plugins.PluginAware' cannot be applied to '(['plugin':java.lang.String])'
Cannot access class 'java.lang.String'. Check your module classpath for missing or conflicting dependencie
Type mismatch.
Required:
java.lang.String
Found:
kotlin.String
Any ideas to what may be the issue?
I tried Kotlin multiplatform JVM type mismatch in InteliJ but doesn't seem to fix the issue.
UPDATE:
Cleared gradle caches, reinstalled Intellij, Import project that was created from start.spring.io with Gradle and Kotlin selected.
Using default gradle wrapper and project jdk (the path says jre)? gives me an error. Open gradle settings just opens the file explorer.
Using default gradle wrapper and machine local JDK same issues with the dependencies from above.
This issue comes up if you set up your own module inside IntelliJ and you think that since you are doing a Kotlin (Maven) project, the SDK should be set to Kotlin. Wrong!
The problem is shown in the first image. The project SDK is set to Kotlin.
Change it to Java. Probably any 8+ Java will be good enough.
This solves the IDE errors and the compiler errors as well.
Unset KOTLIN_HOME and other Kotlin- or Java-related settings you may have in your environment (env to check, unset NAME to unset.)
Then kill any Gradle daemon still running (pkill -f GradleDaemon) and test your Gradle build from the terminal. If all goes well, remove the .idea directory; restart IDEA, making sure to run it without the stray environment variables (for example, launch idea.sh from the terminal where you unset them); and re-import your project, with the choice of using the default Gradle wrapper.
If you need to use standalone Kotlin versions, installed for example through SDKMAN, consider taking the SDKMAN activation lines out of your shell init file (.bashrc for Bash) and into a standalone script (say, ~/bin/sdkman) that will also change your shell prompt (PS1 in Bash) to remind you that you have entered a SDKMAN-managed CLI session.

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:

Is SpringSource Tool Suite 2.6 Grails support broken?

I have recently updated my STS from 2.5.2 to 2.6. Since then, each grails project shows an error in the conf/spring/resources.groovy file reading: Description Resource Path Location Type
Internal compiler error: java.lang.VerifyError: (class: org/codehaus/jdt/groovy/internal/compiler/ast/JDTClassNode, method: initialize signature: ()V) Bad access to protected data at org.codehaus.jdt.groovy.internal.compiler.ast.JDTResolver.createClassNode(JDTResolver.java:461) resources.groovy /GrailsProject/grails-app/conf/spring line 0 Java Problem
The resources.groovy file is as good as empty (in default state), and if I delete it, the error is shown on the DataSource.groovy, so the file itself seems not to be the cause.The used groovy compiler version is 1.7.3.I have made a clean STS 2.6 install, installed the groovy and grails plugins and got the same error.What could be the problem? And is there a solution to this not resulting in downgrading to 2.5.2 again? Thank you
Take a look at your preferences Groovy -> Compiler. Are you by any chance accidentally using Groovy 1.6?
EDIT
That didn't solve the problem, but as described in http://forum.springframework.org/showthread.php?p=357361, upgrade to the latest dev build of Groovy-Eclipse as well as Grails Tooling and that should work.

How do I set where my grails plugins should be installed?

I saw the light and install the joda-time plugin for grails.
However, when I tried to commit my changes to source control I realised that grails had located the files in:
C:\Users\Steve\.grails\1.1.1\plugins
instead of somewhere under the project directory of:
f:\grails\projects\myproject
Yeah I'm using windows :-\
So now when someone pulls down my changes from source control they are missing all the joda-time plugin lovelyness and they are wanting to spank me :)
What should I be setting so that grails doesn't put anything under my user directory?
(It isn't installed as a global plugin - just as a project one - at least I think so, I ran "grails install-plugin joda-time" )
Many thanks in advance.
P.S. Currently listening to Plug In Baby by Muse....how coincidental :D
The plugin is listed in application.properties, so when someone gets your code Grails will install missing plugins the first time they run 'grails run-app' or other commands.
If you want to revert to 1.0.x behavior just create grails-app/conf/BuildConfig.groovy with the line
grails.project.plugins.dir='plugins'
and your plugins will be in with the rest of the project files.

Resources