cbeust / kobalt-intellij-plugin

An IntelliJ plug-in for Kobalt
21 stars 7 forks source link

Project structure lost due to spurious dependency problem #88

Open TimLavers opened 6 years ago

TimLavers commented 6 years ago

I've got these dependencies in my build file:

object Versions { val kotlin = "1.2.10" val kotlintest = "2.0.7" val junit = "4.12" val derby = "10.13.1.1" val hibernate = "5.2.11.Final" val ktor = "0.9.0" }

dependencies {
    compile("org.jetbrains.kotlin:kotlin-runtime:${Versions.kotlin}")
    compile("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
    compile("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}")
    compile("io.ktor:ktor-server-netty:${Versions.ktor}")
    compile("io.ktor:ktor:${Versions.ktor}")
    compile("io.ktor:ktor-gson:${Versions.ktor}")
}

dependenciesTest {
    compile("junit:junit:${Versions.junit}")
    compile("io.kotlintest:kotlintest:${Versions.kotlintest}")
    compile("io.ktor:ktor-server-test-host:${Versions.ktor}")
}

Building from the command line (kobaltw assemble) works fine.

However, when I refresh the project in the Kobalt plugin, the project structure is lost.

The IntelliJ log file includes this message: 2018-01-12 07:10:11,118 [484014126] WARN - ution.rmi.RemoteProcessSupport - WARN: Received error message from Kobalt server: Could not find artifact org.jetbrains.kotlin:kotlin-stdlib:jar:1.1.60-eap-43 in Maven (http://repo1.maven.org/maven2/)

It's not clear why that dependency is required.

The log then continues with: 2018-01-12 07:10:11,162 [484014170] INFO - pl.ProjectRootManagerComponent - project roots have changed 2018-01-12 07:10:11,207 [484014215] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 0ms; general responsiveness: ok; EDT responsiveness: ok 2018-01-12 07:10:11,208 [484014216] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 1ms; general responsiveness: ok; EDT responsiveness: ok 2018-01-12 07:10:11,343 [484014351] ERROR - j.psi.stubs.StubTreeLoaderImpl - Outdated stub in index: file://C:/Code3/xxxxx/kobalt/src/Build.kt indexed at 1515701228729 with document size 3159, doc=DocumentImpl[file://C:/Code3/xxxxx/kobalt/src/Build.kt], docSaved=true, wasIndexedAlready=true, queried at 1515701231946 indexed lengths={chars=3248, bytes=3349} doc length=3159 file length=3258 cached PSI class org.jetbrains.kotlin.psi.KtFile projects with file: 2 java.lang.Exception at com.intellij.psi.stubs.StubTreeLoaderImpl.a(StubTreeLoaderImpl.java:175) at com.intellij.psi.stubs.StubTreeLoaderImpl.a(StubTreeLoaderImpl.java:145) at com.intellij.psi.stubs.StubTreeLoaderImpl.readFromVFile(StubTreeLoaderImpl.java:113) at com.intellij.psi.stubs.StubTreeLoaderImpl.readOrBuild(StubTreeLoaderImpl.java:53) at com.intellij.psi.impl.source.PsiFileImpl.getStubTree(PsiFileImpl.java:651) at com.intellij.psi.impl.source.PsiFileImpl.getStub(PsiFileImpl.java:614) at org.jetbrains.kotlin.psi.KtFile.getStub(KtFile.kt:166) at org.jetbrains.kotlin.psi.KtFile.isScript(KtFile.kt:188) at org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingUtil.shouldHighlightErrors(KotlinHighlightingUtil.kt:36)

If I then change the dependencies to:

object Versions { val kotlin = "1.2.10" val kotlintest = "2.0.7" val junit = "4.12" val derby = "10.13.1.1" val hibernate = "5.2.11.Final" val ktor = "0.9.1-alpha-8" } dependencies { compile("org.jetbrains.kotlin:kotlin-runtime:${Versions.kotlin}") compile("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}") compile("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}") compile("io.ktor:ktor-server-netty:${Versions.ktor}") compile("io.ktor:ktor:${Versions.ktor}") compile("io.ktor:ktor-gson:${Versions.ktor}") }

dependenciesTest { compile("junit:junit:${Versions.junit}") compile("io.kotlintest:kotlintest:${Versions.kotlintest}") // compile("io.ktor:ktor-server-test-host:${Versions.ktor}") } Then the project structure is restored.

However, the original set of dependencies should work fine as they are fine from the command line and they are copied from some gradle projects that work fine.

dmitry-zhuravlev commented 6 years ago

Hm, weird... Could you please share an example project to fast reproduce this problem?

TimLavers commented 6 years ago

Build file attached (could only add as zip). It has four projects. The last one is the issue - see the comment at the end.

Build.zip

barotashish commented 6 years ago

Hi Team,

when I am starting new project in my Android studio, I am getting following error :-

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0. Open File Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0. Open File Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0. Open File Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0. Open File Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0. Open File Show Details

=== My testing environment details :-

OS :- Ubuntu Linux, 18.04 - ( Just upgraded Ubuntu linux from 17.10 )

Android Studio version :- 3.1.2 ( Linux Platform )

barotashish commented 6 years ago

Now also getting IDE Fatal error

screenshot from 2018-05-16 16-01-12

Keesdil commented 5 years ago

barotashish : The IDE Fatal error with "java.lang.exception etcetera" looks like the strange things i have got with my project in Android Studio. Several java files that i made were named in the log file, each one starting with "Outdated stub in index: file:" and then the absolute path of the file. In the editor those files were completely corrupted with log information, resulting in numerous compiler errors. Odd thing : in explorer those files were not showing wrong content! Did anone notice problems like this and / or know a solution ?