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

Does lein-ring support reload changed namespaces somehow? #187

Open
ertugrulcetin opened this issue Jun 14, 2017 · 9 comments
Open

Does lein-ring support reload changed namespaces somehow? #187

ertugrulcetin opened this issue Jun 14, 2017 · 9 comments

Comments

@ertugrulcetin
Copy link

When I add a new namespace to my project or change couple of those my ring application throws an exception that says namespace couldn't be found.I can see changes when I don't touch the namespaces which is very cool but I also want to see the changes when I change (add/delete/update) namespaces.

Does lein-ring support this built in with some configuration?

@weavejester
Copy link
Owner

Adding namespaces work the same way; it's likely that you're just trying to access the namespace without an associated require.

@ertugrulcetin
Copy link
Author

Yeah I need to restart lein app when I introduce new namespace or change one of them, is there any chance to do some adjustment and make this namespace loading automatically?

@weavejester
Copy link
Owner

It should automatically load by default. Could you give some more information about this issue? So for instance:

  • What does the error say?
  • What is the stacktrace?
  • What does your ns declaration look like of both the file being loaded, and the file doing the loading?
  • What are the filenames (perhaps you've added a - instead of an _)?
  • Is your project open source, or can you create a project that demonstrates the problems you're having?
  • What version of Lein-Ring are you using?
  • What does your lein deps :tree output look like?

@ertugrulcetin
Copy link
Author

I was using "0.11.0" but now updated to "0.12.0" and it works I could not reproduce now.
I'm going to try to reproduce , if it happens again I will provide all information you need.Thank you so much for the quick response.

@ertugrulcetin
Copy link
Author

ertugrulcetin commented Jun 17, 2017

@weavejester I think the problem is Clojure.I'm getting Compiler exception:
Alias auth already exists

reproduce steps:
first I have this ->[cl.controller.auth :as auth]
after I change this to that-> [cl.controller.auth-service :as auth]

I guess Clojure caches the first cl.controller.auth namespace's alias which is auth. Then I refactor(rename) the cl.controller.auth to cl.controller.auth-service so I get that exception.

Is there any way to unalias the alias and redefine it?

This is the reason why I have to restart the app.

@MichaelBlume
Copy link
Collaborator

MichaelBlume commented Jun 18, 2017 via email

@ertugrulcetin
Copy link
Author

@weavejester any updates regarding that comment?

@weavejester
Copy link
Owner

Updates in what respect? Lein-Ring uses Clojure's reload mechanism, which won't work in the case where you're trying to overwrite an existing namespace alias. It doesn't currently make use of refresh in tools.namespace, with might solve the issue. A workaround is to run ns-unalias manually.

@ertugrulcetin
Copy link
Author

got it thank you so much!

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

No branches or pull requests

3 participants