cursive icon indicating copy to clipboard operation
cursive copied to clipboard

Leiningen Checkout dependency makes original Project unusable

Open thheller opened this issue 1 year ago • 0 comments

Using Build #IC-221.5080.210, built on April 12, 2022 with Cursive. This has been bugging me for quite a while, so can't say when this was introduced (or if it was an issue). Definitely an issue in 1.12.3.

Reproduction steps:

lein new lib-a
lein new lib-b

For both generated project.clj create a new Cursive Project using New -> Project from existing sources... . Just clicking through the Options and using my default Java 11 JDK.

Once created close both projects. Now add the lib-a as a checkout dependency to lib-b.

cd lib-b
mkdir checkouts
ln -s ../../lib-a lib-a

Now open the lib-b Project again via Open Recent. Once it settled down and found the lib-a checkout (happens automatically) and properly integrated it open lib-a as well. Let that settle again and then close lib-b. At this point it somehow messes with the lib-a project and its lib-a module either disappears completely or just forgets about the lib-a project dir and only shows the source paths.

The lib-a project ends up looking like this, with no module and no way to select sources or so

2022-07-18--08-36

In lib-a hitting the Leiningen -> Refresh Leiningen Projects yields this error and ends up creating a new module lib-a-1 it seems?

2022-07-18--08-37

After all of this it may end up working for a bit, but after a while the lib-a project is lost again and refreshing it ends up creating a lib-a-2. This continues on on my actual lib I'm up to -6 now. I'm not sure exactly what triggers all this but it gets frustrating since all project settings are lost for lib-a every time.

This is the reported error:

modifyEntity: persistent id already exists. Replacing entity with the new one.
Old entity: ModuleEntityData(name=lib-a, type=JAVA_MODULE, dependencies=[com.intellij.workspaceModel.storage.bridgeEntities.ModuleDependencyItem$InheritedSdkDependency@16385339, com.intellij.workspaceModel.storage.bridgeEntities.ModuleDependencyItem$ModuleSourceDependency@216b4355, LibraryDependency(library=LibraryId(name=Leiningen: clojure-complete:0.2.5, tableId=com.intellij.workspaceModel.storage.bridgeEntities.LibraryTableId$ProjectLibraryTableId@325a44f2), exported=false, scope=COMPILE), LibraryDependency(library=LibraryId(name=Leiningen: nrepl:0.6.0, tableId=com.intellij.workspaceModel.storage.bridgeEntities.LibraryTableId$ProjectLibraryTableId@325a44f2), exported=false, scope=COMPILE), LibraryDependency(library=LibraryId(name=Leiningen: org.clojure/clojure:1.10.1, tableId=com.intellij.workspaceModel.storage.bridgeEntities.LibraryTableId$ProjectLibraryTableId@325a44f2), exported=false, scope=COMPILE), LibraryDependency(library=LibraryId(name=Leiningen: org.clojure/core.specs.alpha:0.2.44, tableId=com.intellij.workspaceModel.storage.bridgeEntities.LibraryTableId$ProjectLibraryTableId@325a44f2), exported=false, scope=COMPILE), LibraryDependency(library=LibraryId(name=Leiningen: org.clojure/spec.alpha:0.2.176, tableId=com.intellij.workspaceModel.storage.bridgeEntities.LibraryTableId$ProjectLibraryTableId@325a44f2), exported=false, scope=COMPILE)], classId=0, Companion=com.intellij.workspaceModel.storage.bridgeEntities.ModuleEntityData$Companion@72c6ce7b, entitySource=FileInDirectory(directory=file://C:/Users/thheller/code/tmp/cursive-repro/lib-a, fileNameId=342, projectLocation=DirectoryBased(projectDir=file://C:/Users/thheller/code/tmp/cursive-repro/lib-a, ideaFolder=file://C:/Users/thheller/code/tmp/cursive-repro/lib-a/.idea)), id=0, id=0)
Persistent id: ModuleEntityData(name=lib-a, type=JAVA_MODULE, dependencies=[com.intellij.workspaceModel.storage.bridgeEntities.ModuleDependencyItem$ModuleSourceDependency@216b4355], classId=0, Companion=com.intellij.workspaceModel.storage.bridgeEntities.ModuleEntityData$Companion@72c6ce7b, entitySource=FileInDirectory(directory=file://C:/Users/thheller/code/tmp/cursive-repro/lib-a, fileNameId=355, projectLocation=DirectoryBased(projectDir=file://C:/Users/thheller/code/tmp/cursive-repro/lib-a, ideaFolder=file://C:/Users/thheller/code/tmp/cursive-repro/lib-a/.idea)), id=1, id=1)

Broken consistency: false

com.intellij.workspaceModel.storage.impl.exceptions.PersistentIdAlreadyExistsException: Entity with persistentId: ModuleId(name=lib-a) already exist
	at com.intellij.workspaceModel.storage.impl.WorkspaceEntityStorageBuilderImpl.modifyEntity(WorkspaceEntityStorageImpl.kt:227)
	at com.intellij.workspaceModel.ide.impl.legacyBridge.module.ModifiableModuleModelBridgeImpl.renameModule(ModifiableModuleModelBridgeImpl.kt:269)
	at cursive.build.sync$ensure_module_name$fn__10978.invoke(sync.clj:35)
	at cursive.build.sync$ensure_module_name.invokeStatic(sync.clj:33)
	at cursive.build.sync$ensure_module_name.invoke(sync.clj:29)
	at cursive.leiningen.sync$sync_modules_BANG_.invokeStatic(sync.clj:98)
	at cursive.leiningen.sync$sync_modules_BANG_.invoke(sync.clj:87)
	at cursive.leiningen.sync$sync$fn__26246.invoke(sync.clj:157)
	at cursive.leiningen.sync$sync.invokeStatic(sync.clj:144)
	at cursive.leiningen.sync$sync.invoke(sync.clj:134)
	at clojure.lang.Var.invoke(Var.java:393)
	at cursive.api.DelayedFn.invoke(DelayedFn.java:41)
	at cursive.build.BuildSystemProjectsManager$reimportAllProjects$1$task$1$2.invoke(BuildSystemManager.kt:160)
	at cursive.build.BuildSystemProjectsManager$reimportAllProjects$1$task$1$2.invoke(BuildSystemManager.kt:159)
	at cursive.application.ApplicationKt.invokeLater$lambda-3(Application.kt:20)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:215)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:197)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:511)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:69)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:112)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

thheller avatar Jul 18 '22 06:07 thheller