Fork me on GitHub
#cursive
<
2022-07-06
>
Kamuela09:07:24

I'm guessing this is fairly simple to solve, but I've got an existing project that doesn't have a JDK configured. I'm not sure how to configure it after a project is already loaded into IntelliJ. In fact, I only seem to get an option to choose a JDK when creating a new project. The docs show an "import" option, but if I delete the .idea directory and Open the project, there's no prompt for what kind of project it is or anything. Just loads it up as, what I can see, a fairly normal leiningen project, but then complains that REPL can't be launched on a right click of project.clj because a JDK runtime could not be found. So yeah, where in the preferences can I set the project's JDK?

kennytilton10:07:43

IntelliJ is a bit huge, eh? Even the attempts to explain where to find things fall short. But their own doc may show how to get to the JDK: https://www.jetbrains.com/help/idea/sdk.html#manage_sdks Happy hunting. 🙂 Ah, half way down on the right "Set up the project JDK". hth

Kamuela10:07:34

Thank you. File -> Project Structure. Wasn't in settings at all

kennytilton12:07:53

btw, @U0KLE4WHZ, the way I start using I/J initially with a given existing project is "File>New>Project from existing sources". I can do that safely with a project already being worked. At the end it will ask if you want to overwrite any existing .idea. Just confirm. You are right, btw, "Open" just opens the directory for editing.

thanks3 1
onetom01:07:28

worth reading that whole user guide! it's written very concisely, but yet in enough detail, to get a solid understanding of all of Cursive's capabilities. definitely worth the time reading it!

reefersleep20:07:29

I recently learned about git worktree and would love to use this ability to have different branches of a project checked out at the same time. However, it seems a manual hassle to set up the new project, run configuration etc in Cursive. Is there a good solution for this?

1
onetom00:07:00

i'd very interested in something like this, because it's quite a hassle to switch between branches and constantly stashing/shelving changes. i would much prefer to just have just duplicate source trees checked out, but there should be some good way to distinguish them when opened in parallel and that should probably be a IDE-level feature, which doesn't exist IMHO

cfleming02:07:30

I'm not sure what the answer to this is, I'll have to investigate git worktree.

cfleming02:07:30

It seems like this would probably have to be supported by IntelliJ's git support, but there's not much out there, basically this: https://stackoverflow.com/questions/36438333/how-do-i-use-git-worktrees-in-intellij-idea-2016-1

cfleming22:07:38

Is there anything Cursive-specific you would want from this, or is it more of an IntelliJ question?

reefersleep07:07:48

I guess it’s more of an IntelliJ question, but I’d love for the Cursive stuff to work as well. I don’t care about IntelliJ’s git support in this regard. What I envision is this: I’m working on feature A and I’m spinning up the environment. Someone asks me about feature b. I create a worktree, check out their branch, look at their code (in Cursive), answer their question, delete the worktree, and start using Cursive for feature A, which is now done spinning up. The problem, as I see it, is not git support. I do my git stuff elsewhere. It’s the setting up of the project files, REPL and other project specific stuff to do with IntelliJ/Cursive, that I want to avoid having to do every time I do git worktree add ./temporary.

reefersleep07:07:57

I know git worktree is probably not widely used, so I didn’t expect any specific support for it 🙂 I was just hoping that there was! 😄

reefersleep07:07:03

I read a different thread where Dmitriy Smirnov, one of the IntelliJ maintainers, said that you could commit the idea project files. I don’t like that for this project at work, lots of different people working on it, and I’d like the project to be free of cruft like that. But I get the idea (heh)

reefersleep07:07:37

Alternative; git worktree add ./alternate and then never remove it. Set up project files once, then reuse it every time I want to do some temporary stuff. I figure that might work for most of my use cases. It’s nowhere near as limber as I’d hoped for, but I can still git worktree add ./another when I don’t need to use IntelliJ, e.g. when I just need to read something as plaintext in nvim or less or whatever.

reefersleep07:07:54

Maybe there’s some easy, git-worktree-unrelated way to copy idea files and have them “just work”™ under a different folder? (tbh I haven’t even tried just copying them, yet 😅 )