Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple buildSrc in different composite builds breaks the IntelliJ IDEA import #8920

Closed
GFriedrich opened this issue Apr 2, 2019 · 9 comments
Labels

Comments

@GFriedrich
Copy link
Contributor

When having a root project with two included composite build projects and each of these projects uses a "buildSrc" folder, the import of the main project via IntelliJ IDEA fails.

Expected Behavior

The import/sync should run without an issue.

Current Behavior

The import/sync of the Gradle project fails.

Steps to Reproduce

Have a project A including two other composite build projects B and C.
B and C should have a buildSrc folder.
Importing/running sync in IntelliJ IDEA fails due to:

Caused by: java.lang.IllegalArgumentException: Duplicate root element buildSrc
	at org.gradle.plugins.ide.internal.configurer.HierarchicalElementDeduplicator$StatefulDeduplicator.deduplicate(HierarchicalElementDeduplicator.java:122)
	at org.gradle.plugins.ide.internal.configurer.HierarchicalElementDeduplicator$StatefulDeduplicator.calculateNewNames(HierarchicalElementDeduplicator.java:102)
	at org.gradle.plugins.ide.internal.configurer.HierarchicalElementDeduplicator$StatefulDeduplicator.getNewNames(HierarchicalElementDeduplicator.java:89)
	at org.gradle.plugins.ide.internal.configurer.HierarchicalElementDeduplicator$StatefulDeduplicator.access$100(HierarchicalElementDeduplicator.java:73)
	at org.gradle.plugins.ide.internal.configurer.HierarchicalElementDeduplicator.deduplicate(HierarchicalElementDeduplicator.java:67)
	at org.gradle.plugins.ide.internal.configurer.DefaultUniqueProjectNameProvider.getDeduplicatedNames(DefaultUniqueProjectNameProvider.java:44)
	at org.gradle.plugins.ide.internal.configurer.DefaultUniqueProjectNameProvider.getUniqueName(DefaultUniqueProjectNameProvider.java:34)
	at org.gradle.plugins.ide.idea.IdeaPlugin.configureIdeaModule(IdeaPlugin.java:265)
	at org.gradle.plugins.ide.idea.IdeaPlugin.onApply(IdeaPlugin.java:136)

As far as I can see, during the import/sync the IDEA plugin of Gradle gets included to all builds to gather the Gradle model for projects. But obviously the plugin can't handle multiple buildSrc folders.

Your Environment

Gradle 5.3.1

@GFriedrich
Copy link
Contributor Author

GFriedrich commented Apr 2, 2019

Oh great - I've found a workaroud:
Placing a settings.gradle file within the buildSrc folder to overwrite the rootProject.name fixes the issue. Hopefully this doesn't end up in new issues elsewhere. 😉

@big-guy
Copy link
Member

big-guy commented Apr 9, 2019

@GFriedrich do you know if this used to work with an earlier version of Gradle or IDEA?

@GFriedrich
Copy link
Contributor Author

@big-guy: No, otherwise I would have created a regression issue.

@JojOatXGME
Copy link

I could not reproduce it on Windows but a colleague had the same problem on Mac. I'm just wondering if the bug might be platform dependent. However, it would seem suspect to me if this behavior depends on the operating system. Anyway, did you encounter the issue on Windows or on another operating system?

@GFriedrich
Copy link
Contributor Author

I've experienced the issue on Windows and Linux.

@JojOatXGME
Copy link

There was some leftover of a buildSrc on the Mac. After deleting it, the problem did not occur anymore. Interestingly, there are still multiple other buildSrc directories within the composite build which do not cause the problem.

geiralund added a commit to navikt/dagpenger that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920
geiralund added a commit to navikt/dp-regel-api-arena-adapter that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-vedtakresultat-lytter that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-kafka-offset-monitor that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-regel-minsteinntekt that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dagpenger-joark-mottak that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-datalaster-inntekt that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dagpenger-streams that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dagpenger-oppslag that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-regel-grunnlag that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-regel-periode that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dagpenger-events that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-inntekt that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-biblioteker that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
geiralund added a commit to navikt/dp-regel-api that referenced this issue Aug 6, 2019
… unique root project name for buildSrc in gradle composite builds

gradle/gradle#8920

[skip ci]
@wayonEmes
Copy link

Oh great - I've found a workaroud:
Placing a settings.gradle file within the buildSrc folder to overwrite the rootProject.name fixes the issue. Hopefully this doesn't end up in new issues elsewhere. 😉

thanks . I don't know why, but it works.

@stale
Copy link

stale bot commented Oct 29, 2020

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

@stale stale bot added the stale label Oct 29, 2020
@GFriedrich
Copy link
Contributor Author

GFriedrich commented Oct 29, 2020

Just checked and at least with latest IntelliJ IDEA 2020.2.3 and Gradle 6.5.1 (or higher) this is not happening anylonger.
Therefore I'm closing the ticket...

@wolfs wolfs closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants