Fork me on GitHub
#cursive
<
2015-11-13
>
sgerguri09:11:04

I keep running into this weird bug in Cursive - increasing the version number of a dependency does not make Cursive aware of it. It can't see the newer dependency and will insist on using the old one.

sgerguri09:11:17

What's worse is that when I finally do manage to convince Cursive to use the newer version (through manual editing of the project's .iml file) it will still start any REPL sessions with the old dependency.

sgerguri09:11:40

This is happening on the latest IDEA 14.1 with the latest Cursive plugin.

cfleming09:11:06

@sgerguri: You need to refresh the dependencies after editing your project file.

cfleming10:11:00

You can do it in the leiningen toolwindow (refresh button) or by executing the “Refresh Leiningen Projects” action from Cmd-Shift-A

sgerguri10:11:15

That did not help. 😕

sgerguri10:11:32

Editor is picking the new version up just fine, but REPL is still being started with the old version.

cfleming10:11:22

So if you look at the project structure view, you see the new version added to the module, right?

cfleming10:11:29

Cmd-; on mac, at least

cfleming10:11:48

Look at the module view, then check the dependencies of your module.

sgerguri10:11:02

Yes - I see it there, in the latest version.

cfleming10:11:21

Ok. What sort of REPL are you running?

sgerguri10:11:24

Interestingly, the Project view lists both versions in the 'External Libraries' tree.

cfleming10:11:43

Do you have multiple modules in your project?

sgerguri10:11:44

nREPL with Leiningen, with the correct project

cfleming10:11:30

Ok, and in the classpath, it’s definitely picking up the wrong version? You can see that by unfolding the first line in the REPL window.

sgerguri10:11:34

Yes I do, and that's another bug - if I remove them they'll be added eventually automatically when I restart the IDE.

sgerguri10:11:09

Although to be fair that sounds more like a bug in IDEA rather than the plugin itself.

cfleming10:11:31

That’s not a bug

cfleming10:11:56

You’re talking about manually modifying the module file, right?

sgerguri10:11:57

It's picking up the right version, which is strange.

cfleming10:11:16

That doesn’t sound strange simple_smile

sgerguri10:11:18

But it's clearly complaining about an import in a ns that uses a function from it.]

sgerguri10:11:28

And the function is there.

sgerguri10:11:36

Or maybe I'm just dumb.

cfleming10:11:38

What does the import look like?

sgerguri10:11:49

require with multiple refers

sgerguri10:11:56

It's complaining about one of those.

sgerguri10:11:11

I can click through it to its definition, so it should be correct, no typo etc.

cfleming10:11:33

Can you send a screenshot of the require?

sgerguri10:11:18

Re. module file - either through the Project view, or through project settings.

cfleming10:11:16

If you modify the module file, those changes will be overwritten the next time the Lein project is synced (opening your project, manually refreshing etc)

cfleming10:11:25

The Maven integration works the same way.

cfleming10:11:55

The idea is your module should reflect what is in the project.clj, and Cursive will make it like that every time.

sgerguri10:11:48

^ That's the require line. Everything except delete-item! works.

sgerguri10:11:10

Although like I said, delete-item! can be clicked through to its definition from here. And it's using the download deps for that.

cfleming10:11:24

And if you click to delete-item!, you can … right. What does its definition look like?

sgerguri10:11:29

Re. modules - I was referring to other Clojure projects that I have merely added as 'new modules from existing sources'.

sgerguri10:11:47

I may be missing sth but I can't see anything in project.clj that would refer to them.

cfleming10:11:11

So you add them as modules, and later they disappear?

sgerguri10:11:17

I add them as modules, but cannot remove them permanently - they'll be added back the next time I restart the IDE.

cfleming10:11:39

Are they leiningen modules?

sgerguri10:11:45

Yes, all of them

sgerguri10:11:03

^^ That's the clicked-through fn that I'm referring to.

sgerguri10:11:19

It's on a yellow tab, so that's a dependency.

cfleming10:11:24

Ok, then you have to delete them from the leiningen toolwindow. Select the project, and remove it from there. It’ll ask if you want to remove the associated module, say “yes"

cfleming10:11:24

I’m not sure if I can catch the deletion of a module in IntelliJ and remove the lein part automatically.

sgerguri10:11:57

Ah, that seems to have worked. It's a bit quirky, since normally I interact with the Project view so I'd like to remove it from there, but as long as there's a reliable way of doing it it's ok.

sgerguri10:11:24

That hasn't changed anything about delete-item! though. simple_smile

cfleming10:11:43

No, that’s weird. So what do you see - Cursive says it can’t be resolved?

sgerguri10:11:57

It gives me CompilerException in the REPL.

sgerguri10:11:05

When I load the ns, that is.

cfleming10:11:20

Does it work using lein repl?

cfleming10:11:49

Cursive should be doing basically exactly the same thing.

cfleming10:11:04

i.e. it delegates all that to lein.

sgerguri10:11:10

It doesn't. Glad to see the problem is elsewhere (likely between the keyboard and the chair).

sgerguri10:11:31

Well, sorry about the false alarm!

cfleming10:11:49

No worries, glad it’s working. Or at least, it’s not working in a consistent way.