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

Put modules before libraries in Intellij iml files #1846

Merged
merged 2 commits into from
Apr 20, 2022
Merged

Conversation

yakivy
Copy link
Contributor

@yakivy yakivy commented Apr 20, 2022

PR fixes dependency priority for GenIdea command.

Problem description:
When multiple dependencies have a class with the same name, Mill takes first one from the classpath, as well as Intellij takes first one from the iml file. If some dependencies are modules, Mill put them higher in the classpath, so module classes always take precedence over libraries. But GenIdea put modules after the libraries and therefore Intellij resolves different than Mill class versions. Example of generated iml file:

...
<orderEntry type="inheritedJdk"/>
<orderEntry type="sourceFolder" forTests="false"/>
<orderEntry type="library" name="..." level="project"/>
...
<orderEntry type="module" module-name="..." exported=""/>
...

Fix description:
I swapped libraries and modules in the iml file, so result file looks like:

...
<orderEntry type="inheritedJdk"/>
<orderEntry type="sourceFolder" forTests="false"/>
<orderEntry type="module" module-name="..." exported=""/>
...
<orderEntry type="library" name="..." level="project"/>
...

To prove that this order is correct, I generated iml files for the same project with SBT and Mill BSP, both of them put modules before libraries.

Copy link
Member

@lolgab lolgab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@lefou lefou merged commit 319d193 into com-lihaoyi:main Apr 20, 2022
@lefou lefou added this to the after 0.10.3 milestone Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants