Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate key org.jetbrains.jps.model.module.impl.JpsModuleImpl

my project always was working fine until i opened it today in intelIj and tried to run it i get this error

Error:maven-annotations-test:myapp: java.lang.IllegalStateException: Duplicate key org.jetbrains.jps.model.module.impl.JpsModuleImpl@50eac852

it's not a maven project so i don't get what's causing this

like image 645
CriminalDuck Avatar asked Jan 03 '19 06:01

CriminalDuck


2 Answers

Related to https://youtrack.jetbrains.com/issue/IDEA-225394 - Internal error: (java.lang.IllegalStateException) Duplicate key

I managed to fix something like this only after closing Intellij and deleting the directory C:\Users\UserName\AppData\Local\JetBrains\IntelliJIdea2020.1

After selecting Run -> Run and running com.appointment.publishing in spring-boot-app the project works fine for the first time.

After modifying the test file on the project and trying to run it more times, it throws the following exception.

After throwing it, the only way to fix it, is going on Build -> Rebuild Project.

However, the problems start happening again if you try to run the project more than one time (after modifying the test file).

Error:Internal error: (java.lang.IllegalStateException) Duplicate key Validate JSPs in 'spring-boot-appointment-publishing:war exploded'
java.lang.IllegalStateException: Duplicate key Validate JSPs in 'spring-boot-appointment-publishing:war exploded'
    at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
    at java.util.HashMap.merge(HashMap.java:1253)
    at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
    at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at org.jetbrains.jps.javaee.build.jspValidation.JspValidationTarget$Type.createLoader(JspValidationTarget.java:156)
    at org.jetbrains.jps.incremental.storage.BuildTargetTypeState.load(BuildTargetTypeState.java:63)
    at org.jetbrains.jps.incremental.storage.BuildTargetTypeState.<init>(BuildTargetTypeState.java:52)
    at org.jetbrains.jps.incremental.storage.BuildTargetsState.getTypeState(BuildTargetsState.java:122)
    at org.jetbrains.jps.incremental.storage.BuildTargetsState.getAverageBuildTime(BuildTargetsState.java:116)
    at org.jetbrains.jps.incremental.IncProjectBuilder.checkRebuildRequired(IncProjectBuilder.java:285)
    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:167)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:297)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:130)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:218)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

IU-201.8538.31, JRE 11.0.7+10-b765.64x64 JetBrains s.r.o., OS Windows 10(amd64) v10.0 , screens 1920x1080

I noticed following error after invoking Build -> Build Project:

Error:Internal error: (java.lang.IllegalStateException) Duplicate key emdms-server (attempted merging values org.jetbrains.jps.model.module.impl.JpsModuleImpl@e8df99a and org.jetbrains.jps.model.module.impl.JpsModuleImpl@64b73e7a)
java.lang.IllegalStateException: Duplicate key emdms-server (attempted merging values org.jetbrains.jps.model.module.impl.JpsModuleImpl@e8df99a and org.jetbrains.jps.model.module.impl.JpsModuleImpl@64b73e7a)
at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at org.jetbrains.jps.maven.model.impl.MavenAnnotationProcessorTargetType.createLoader(MavenAnnotationProcessorTargetType.java:50)
at org.jetbrains.jps.incremental.storage.BuildTargetTypeState.load(BuildTargetTypeState.java:66)
at org.jetbrains.jps.incremental.storage.BuildTargetTypeState.(BuildTargetTypeState.java:55)
at org.jetbrains.jps.incremental.storage.BuildTargetsState.getTypeState(BuildTargetsState.java:110)
at org.jetbrains.jps.incremental.storage.BuildTargetsState.getAverageBuildTime(BuildTargetsState.java:104)
at org.jetbrains.jps.incremental.messages.BuildProgress.(BuildProgress.java:70)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:365)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:288)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:121)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

IU-192.6817.14, JRE 11.0.4 10-b304.69x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920x1080

Update: The exception has disappeared after right click on parent pom.xml -> Maven -> Reimport.

Some times just deleing the IntelliJIdea2020.1 directory was not enough. I had to also delete my C:\Users\UserName\.m2 directory.

@Jet Brains Team: The problem is caused by duplicated artifact configuration files. In order to fix it, you need to delete application_name_war_exploded2.xml and application_name_war2.xml files from .idea/artifacts directory. Not sure why these duplicating artifacts were produced though. Did you edit artifact configurations manually in File | Project Structure | Artifacts?

like image 72
user Avatar answered Nov 20 '22 16:11

user


Left upper panel on Intellij IDEA

Click on Reimport All Maven Projects - First icon on the left in the image above.

Worked for me!

like image 10
Joseph Waweru Avatar answered Nov 20 '22 17:11

Joseph Waweru