Skip to content

Duplicate bundled template error in tests using 2.0.1 with 2024.1 IDE #1755

@Undin

Description

@Undin

What happened?

Starring from 2.0.1 if:

  • plugin project has several modules, let's name them A and B
  • A depends on B
  • B has internal template in its resources dir

then any test in module A which invokes com.intellij.ide.fileTemplates.FileTemplateManager#findInternalTemplate or similar method fails with Duplicate bundled template error.
It seems there are two artifacts (<module>.jar and <module>-base.jar) which are used as a dependency between two project modules which leads to duplicate recourses

Note, the issue is not reproduced with 2024.2 IDE dependencies or with 2.0.0 intellij-platform gradle plugin

Similar to #1640

Relevant log output or stack trace

Duplicate bundled template template1.txt [(root=jar:file:/Users/Arseniy.Pendryak/Work/intellij-platform-gradle-plugins-bugs/module/build/libs/module-base.jar!/fileTemplates, path=internal/template1.txt.ft), (root=jar:file:/Users/Arseniy.Pendryak/Work/intellij-platform-gradle-plugins-bugs/module/build/libs/module.jar!/fileTemplates, path=internal/template1.txt.ft)]
java.lang.Throwable: Duplicate bundled template template1.txt [(root=jar:file:/Users/Arseniy.Pendryak/Work/intellij-platform-gradle-plugins-bugs/module/build/libs/module-base.jar!/fileTemplates, path=internal/template1.txt.ft), (root=jar:file:/Users/Arseniy.Pendryak/Work/intellij-platform-gradle-plugins-bugs/module/build/libs/module.jar!/fileTemplates, path=internal/template1.txt.ft)]
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
	at com.intellij.ide.fileTemplates.impl.FTManager.<init>(FTManager.java:70)
	at com.intellij.ide.fileTemplates.impl.FileTemplatesLoaderKt.loadConfiguration(FileTemplatesLoader.kt:170)
	at com.intellij.ide.fileTemplates.impl.FileTemplatesLoaderKt.access$loadConfiguration(FileTemplatesLoader.kt:1)
	at com.intellij.ide.fileTemplates.impl.FileTemplatesLoader$managers$1.invoke(FileTemplatesLoader.kt:55)
	at com.intellij.ide.fileTemplates.impl.FileTemplatesLoader$managers$1.invoke(FileTemplatesLoader.kt:55)
	at com.intellij.util.concurrency.SynchronizedClearableLazy._get_value_$lambda$1$lambda$0(SynchronizedClearableLazy.kt:41)
	at java.base/java.util.concurrent.atomic.AtomicReference.updateAndGet(AtomicReference.java:210)
	at com.intellij.util.concurrency.SynchronizedClearableLazy.getValue(SynchronizedClearableLazy.kt:40)
	at com.intellij.ide.fileTemplates.impl.FileTemplatesLoader.getInternalTemplatesManager(FileTemplatesLoader.kt:64)
	at com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl.findInternalTemplate(FileTemplateManagerImpl.java:245)
	at org.jetbrains.intellij.platform.example.ExampleTest.simple test(ExampleTest.kt:14)

Steps to reproduce

https://github.com/Undin/intellij-platform-gradle-plugins-bugs/tree/duplicate-template-files-in-tests-2.0.1 and run org.jetbrains.intellij.platform.example.ExampleTest

Gradle IntelliJ Plugin version

2.0.1

Gradle version

8.7

Operating System

macOS

Link to build, i.e. failing GitHub Action job

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions