简体   繁体   中英

IntelliJ sbt: Incorrectly resolved dependency paths

I'm running into an issue where IntelliJ (IntelliJ 13.1.4 on Windows 7) seems to resolve incorrect paths in a multi-module setup using SBT.

Initially I use the sbt-idea plugin to generate the IntelliJ project files but each time I load my project I observe that IntelliJ refreshes its dependencies again using SBT and generates incorrect dependency paths in the module files (.iml).

The relevant section (and it only goes wrong in this section):

...
<orderEntry type="module-library">
   <library name="SBT: unmanaged-jars">
     <CLASSES>
       <root url="file://$USER_HOME$/.bnd/cache/https%3A%2F%2Fkate.rnd.hq.company.net%2Fartifactory%2Fsimple%2Fbundles-release-local%2Fcom.google.guava%2F14.0.1%2Fbundles" />

...

When IntelliJ refreshes the project using 'SBT' this gets turned into:

...
<orderEntry type="module-library">
  <library name="SBT: unmanaged-jars">
    <CLASSES>
      <root url="file://$MODULE_DIR$/../&#10;      ~/.bnd/cache/https%3A%2F%2Fcompany.net%2Fartifactory%2Fsimple%2Fbundles-release-local%2Fcom.google.guava%2F14.0.1%2Fbundles/com.google.guava.jar&#10;    " />
...

As you can see the URL gets messed up for some reason. What I can see is that IntelliJ, right after opening my project, is running SBT related tasks: "Refreshing 'project_name' SBT Project" etc ... And this changes the paths. (Note: when asked, I 'Ignore' the sbt changes detected.)

I tried to fix these paths in the iml files directly but IntelliJ keeps on overwriting my changes when this refreshing happens.

So far there may be are 2 options that would help to make progress:

1) I have been trying to make IntelliJ only rely on the project files based or generated by the sbt-idea plugin. For this I do not want IntelliJ to trigger any SBT resolving or changing of my module files.

So the question becomes : how can I stop IntelliJ from refreshing my SBT projects?

In the SBT tab in IntelliJ settings a I see a configuration but I cannot remove or disable it.

2) Preferably I would like the paths to be resolved correctly of course but this might be a bug in IntelliJ or in the way the sbt tasks are interpreted. Even better would be if I can use the out of the box SBT support but and I cannot pin point where what is going wrong which makes it hard. Any suggestions in this regards are welcome too.

More background info:

Our project is using bnd to work with OSGi and we have created sbt tasks to integrate this in our build process. Using the SBT built support in IntelliJ did not work with our current set up (I forget why) but on a per bundle/jar/component level I could generate the IntelliJ project files using the sbt-idea plugin and this worked fine. Recently we moved our bnd support in sbt to the 'root' level using a multi-module setup and I run into this issue.

Kind regards,

Hans

这已在Intellij 14中修复。使用内置的sbt支持,我的项目不再需要任何工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM