Problem with Gradle play plugin: Could not copy MANIFEST.MF / Multiple entries with same key

plugins

(Szczepan Faber) #1

On Gradle 3.1, we noticed following exception when using Gradle play plugin on our sample project.

:common:createPlayBinaryDistributionJar

FAILURE: Build failed with an exception.

* What went wrong:

Multiple entries with same key: /Users/sfaber/.gradle/caches/modules-2/files-2.1/edu.stanford.nlp/stanford-segmenter/1.6.8-LI3/f7c1d6c27fb9af354d7049fa727146dedbeb7310/stanford-segmenter-1.6.8-LI3.jar=edu.stanford.nlp-stanford-segmenter-1.6.8-LI3.jar and /Users/sfaber/.gradle/caches/modules-2/files-2.1/edu.stanford.nlp/stanford-segmenter/1.6.8-LI3/f7c1d6c27fb9af354d7049fa727146dedbeb7310/stanford-segmenter-1.6.8-LI3.jar=edu.stanford.nlp-stanford-segmenter-1.6.8-LI3.jar

We worked around the problem by declaring in root build.gradle:

configurations.all {
        exclude module: 'stanford-segmenter'
}

Any pointers about this exception? stanford-segmenter is a transitive dependency pulled into the dependency graph from multiple modules (output from dependencies task: https://gist.github.com/szczepiq/af6d5b00c4b83feaba95d9ac4c37984e)

Full stack trace:

* What went wrong:
Multiple entries with same key: /Users/sfaber/.gradle/caches/modules-2/files-2.1/edu.stanford.nlp/stanford-segmenter/1.6.8-LI3/f7c1d6c27fb9af354d7049fa727146dedbeb7310/stanford-segmenter-1.6.8-LI3.jar=edu.stanford.nlp-stanford-segmenter-1.6.8-LI3.jar and /Users/sfaber/.gradle/caches/modules-2/files-2.1/edu.stanford.nlp/stanford-segmenter/1.6.8-LI3/f7c1d6c27fb9af354d7049fa727146dedbeb7310/stanford-segmenter-1.6.8-LI3.jar=edu.stanford.nlp-stanford-segmenter-1.6.8-LI3.jar

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
java.lang.IllegalArgumentException: Multiple entries with same key: /Users/sfaber/.gradle/caches/modules-2/files-2.1/edu.stanford.nlp/stanford-segmenter/1.6.8-LI3/f7c1d6c27fb9af354d7049fa727146dedbeb7310/stanford-segmenter-1.6.8-LI3.jar=edu.stanford.nlp-stanford-segmenter-1.6.8-LI3.jar and /Users/sfaber/.gradle/caches/modules-2/files-2.1/edu.stanford.nlp/stanford-segmenter/1.6.8-LI3/f7c1d6c27fb9af354d7049fa727146dedbeb7310/stanford-segmenter-1.6.8-LI3.jar=edu.stanford.nlp-stanford-segmenter-1.6.8-LI3.jar
        at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:150)
        at com.google.common.collect.RegularImmutableMap.checkNoConflictInBucket(RegularImmutableMap.java:104)
        at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:70)
        at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:254)
        at org.gradle.play.plugins.PlayDistributionPlugin$PrefixArtifactFileNames.calculate(PlayDistributionPlugin.java:305)
        at org.gradle.play.plugins.PlayDistributionPlugin$PrefixArtifactFileNames.calculateRenames(PlayDistributionPlugin.java:282)
        at org.gradle.play.plugins.PlayDistributionPlugin$PrefixArtifactFileNames.apply(PlayDistributionPlugin.java:272)
        at org.gradle.play.plugins.PlayDistributionPlugin$PrefixArtifactFileNames.apply(PlayDistributionPlugin.java:257)
        at com.google.common.collect.Iterators$8.transform(Iterators.java:794)
        at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
        at com.google.common.base.Joiner.appendTo(Joiner.java:108)
        at com.google.common.base.Joiner.appendTo(Joiner.java:152)
        at com.google.common.base.Joiner.join(Joiner.java:193)
        at com.google.common.base.Joiner.join(Joiner.java:183)
        at org.gradle.play.plugins.PlayDistributionPlugin$PlayManifestClasspath.toString(PlayDistributionPlugin.java:245)
        at org.gradle.api.java.archives.internal.DefaultManifest.addMainAttributesToJavaManifest(DefaultManifest.java:145)
        at org.gradle.api.java.archives.internal.DefaultManifest.generateJavaManifest(DefaultManifest.java:137)
        at org.gradle.api.java.archives.internal.DefaultManifest.writeTo(DefaultManifest.java:220)
        at org.gradle.api.java.archives.internal.DefaultManifest.writeTo(DefaultManifest.java:214)
        at org.gradle.jvm.tasks.Jar$1$1.execute(Jar.java:80)
        at org.gradle.jvm.tasks.Jar$1$1.execute(Jar.java:67)
        at org.gradle.api.internal.file.collections.MapFileTree$FileVisitDetailsImpl.copyTo(MapFileTree.java:182)
        at org.gradle.api.internal.file.collections.MapFileTree$FileVisitDetailsImpl.generateContent(MapFileTree.java:200)
        at org.gradle.api.internal.file.collections.MapFileTree$FileVisitDetailsImpl.updateFileOnlyWhenGeneratedContentChanges(MapFileTree.java:188)
        at org.gradle.api.internal.file.collections.MapFileTree$FileVisitDetailsImpl.getFile(MapFileTree.java:172)
        at org.gradle.api.internal.changedetection.state.AbstractFileCollectionSnapshotter$1.run(AbstractFileCollectionSnapshotter.java:73)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
        at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:60)
        at org.gradle.api.internal.changedetection.state.AbstractFileCollectionSnapshotter.snapshot(AbstractFileCollectionSnapshotter.java:70)
        at org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter.snapshot(DefaultFileCollectionSnapshotter.java:31)
        at org.gradle.api.internal.changedetection.state.AbstractFileCollectionSnapshotter.snapshot(AbstractFileCollectionSnapshotter.java:100)
        at org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter.snapshot(DefaultFileCollectionSnapshotter.java:31)
        at org.gradle.api.internal.changedetection.rules.AbstractNamedFileSnapshotTaskStateChanges.buildSnapshots(AbstractNamedFileSnapshotTaskStateChanges.java:85)
        at org.gradle.api.internal.changedetection.rules.AbstractNamedFileSnapshotTaskStateChanges.<init>(AbstractNamedFileSnapshotTaskStateChanges.java:53)
        at org.gradle.api.internal.changedetection.rules.InputFilesTaskStateChanges.<init>(InputFilesTaskStateChanges.java:28)
        at org.gradle.api.internal.changedetection.rules.TaskUpToDateState.<init>(TaskUpToDateState.java:57)
        at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.getStates(DefaultTaskArtifactStateRepository.java:162)
        at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:82)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:233)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:74)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:55)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:186)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:183)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:33)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:112)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:92)
        at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:79)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:51)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:59)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.execute(HintGCAfterBuild.java:44)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:293)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)


(William Luc Ritchie) #2

Originally I was thinking that this looked like something that might be fixed with sometask.duplicatesStrategy = DuplicatesStrategy.EXCLUDE. Looking at the plugin’s code, though, I’m less confident. In general if it’s reasonable for duplicates to appear in the resolved artifacts list, then this is probably a plugin bug.