I migrated my Gradle project config for Kotlin-script usage: now I have both build.gradle and build.gradle.kts and can switch between them configuring settings.gradle:
project(':myProject').buildFileName='build.gradle.kts'
The issue is kts build.gradle.kts is not properly highlited: it does not resolve dependencies, says version = 123 is not a valid word and so on.
I use Idea Ultimate 2017.1.3 and kotlin-plugin 1.1.2. What's the issue? Deleting build.gradle doesn't help either.
gradle-script-kotlin project files are highlited correctly.
The issue probably was I used incorrect gradle version. I recreated the project specifying gradle version 3.5 and now it works fine. Probably I should use gradle wrapper to prevent the same issue occurence on other developers' machines.
Related
I have multi module maven project in intelliJ 2019.3 (Ultimate)
I am not able to get all dependencies after several tries. I tried below solutions as well
Solution 1
Solution 2
I noticed under the Maven tool same module shows twice as below
Not sure that caused the issue here.
Strangely I don't see any red lines in the any of the POMs
Provided that you can build project from command line Maven and dependencies are downloaded.
In IntelliJ IDEA please try: File | New | Project from Existing Sources action and point to pom.xml file to import project from. Then choose to delete existing project configuration.
I started from a regular non-Gradle Kotlin project. Then I decided later on to link my project to Gradle. I have set up my build.gradle.kts as mentioned in the Kotlin documentation:
plugins {
kotlin("jvm") version "1.3.72"
}
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib"))
}
The build was successful. However, IntelliJ IDEA could no longer recognize my Kotlin modules (no syntax highlighting, etc.). Even the option of creating new Kotlin files was no longer available. So I thought maybe I just needed to mark the src directory as the Source Root, but the error "Kotlin not configured" appeared at the top.
Is there something wrong with my build? I'm still new to Gradle. I've tried other solutions like invalidating the cache and changing the dependencies, but none of them seemed to work.
I closed my project, and then I ran:
rm -rf .idea .gradle gradle
and then it worked again
I also did face this problem suddenly. I solve this by
Invalidate Caches and Restart
Go to the top left File>Invalidate Caches...
It may not help in your case.
This happened to me while trying to convert a Java file into Kotlin, with a message saying there wasn't any configuration available.
It turned out that this was caused by having the Java file in a non-source folder.
Update: see the self-answer. The issue seems to be with Maven import or some sort of corruption of a module's settings after the import.
I have a very large multi-module Maven IntelliJ project with 3 separate roots.
I am building the whole project in preparation to commit.
I am getting the following error from IntelliJ 2017.2.3 Ultimate:
Information:Eclipse compiler 4.6.2 was used to compile java sources
...
Error:java: Target level '1.5' is incompatible with source level '1.8'. A target level '1.8' or better is required
None of the code is supposed to compile with Java 5, it's all Java 8.
The project is configured with JDK 1.8
Maven's maven-compiler-plugin is already configured to use version 1.8 of Java as explained here.
2 questions:
What causes this? Is it a known bug with IntelliJ?
How do I find out which module of the 100 or so modules in the project is the one causing the issue?
I was getting this for a few maven modules in my project, I could get rid of this by updating the .iml files under those modules by changing the following entry to 1.8-
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" /
The Error:
Failed to sync Gradle project '-'
Error:Unable to find method 'org.gradle.internal.logging.progress.DefaultProgressLoggerFactory.(Lorg/gradle/internal/logging/progress/ProgressListener;Lorg/gradle/internal/time/TimeProvider;)V'.
You can see, a constructor inside a class, which is found in the logging jar (gradle_home/lib/grade-logging-version.jar) is missing.
So, I think the Class-Path does not contain this jar file.
Gradle Version: 3.5
Running using the Command Line works.
I have already tried this:
Gradle sync failed: Unable to find method
to-find-method, it does not work for me.
I have tried to use different versions.
I can't see any difference when enabling
"Use default gradle wrapper"
"Use gradle wrapper task configuration"
"Use local gradle distribution".
I had the exact same problem today.
The only way I was able to get it to work was to remove my IntelliJ IDEA IDE, get the latest from the website (with JDK) and put it in a new folder (i.e. no overwriting existing files).
After that, I deleted the .idea folder from the project and reimported it cleanly into the "new" IntelliJ.
I suspect upgrading IntelliJ from Version <= 2016.x caused the issue, since a new installation / clean extraction from archive caused it to work on the fly.
As shown in the screenshot there is a dependency of the dl4j-0.4-examples project that is unable to be loaded by intellij.
Unable to get dependency information: Unable to read the metadata file
for artifact 'com.github.jai-imageio-core.jar': Invalid JDK version in
profile "java8-and-higher': Unbounded range [1.8
A similar problem resolved in this question
https://github.com/google/gson/issues/596
as quick fix open the pom file at your local repository and add ')'
and should looks like
91 [1.8,)
save and execute again
But in this case there is no jdk tag: so that approach can not be used.
Has anyone found a workaround to load this project into intellij?
The owners of the project have recognized this as an issue. If you would like to follow along here is the bug tracker:
https://github.com/deeplearning4j/dl4j-0.4-examples/issues/76
Update 2/28/16: The resolution: I needed to do
brew switch maven 3.3.9
There were multiple versions of maven installed on my machine but I did not know about brew switch. So some ways maven was working without doing the switch - but for this project a completely clean maven installation was required.