Comments (8)
I created a plugin for this issue:
http://github.com/ericlavigne/leiningen-run
from leiningen.
Also it would be nice if you wouldn't need MainClass for it but just run Clojure script.
from leiningen.
I can find MainClass in project.clj. How would I determine which file to use as the script?
One way is to pass it as a commandline argument
- lein run main.clj
However, I would also like to be able to provide arguments to -main
- lein run 8080 true
which makes this ambiguous
- lein run main.clj 8080 true
from leiningen.
Is it worth adding a "script" task that is identical to "run" except that it expects a script name?
- lein run 8080 true
- lein script main 8080 true
from leiningen.
How about adding :script to project.clj so you don't have to change optional parameters syntax?
from leiningen.
If the project only has one :script, then it seems the only advantage of script vs main class is to avoid "(:gen-class)" and "(defn main []", which will still be needed if you want to create an executable jar for this application.
from leiningen.
Though I am not convinced that you must have a script, script functionality could mimic Leiningen's behaviour in how it uses project.clj.
lein run could run main.clj by convention (run.clj might be a better name because it matches the name of the Leiningen task) if it exists. Any other scripts or behaviour could be dispatched from that script. This script wouldn't be run by a executable jar but could be useful for porting legacy Clojure scripts to Leiningen, and non-slime users who run a new repl every time they save their code (they do exist).
I haven't tried lein run yet. If my opinion changes I will feedback here.
from leiningen.
Closing this issue here; will merge into leiningen proper after the run plugin has seen more use. Thanks!
from leiningen.
Related Issues (20)
- How to use prep-tasks with lein run HOT 1
- could not find a non empty configuration file to load. HOT 2
- Lein repl failed caused by: java.lang.ClassNotFoundException: jdk.javadoc.doclet.Doclet HOT 6
- Hitting a wall trying to package lein HOT 4
- Documentation "lein help new" does not list templates HOT 3
- (Uber)jar name from environment variable HOT 2
- Trouble starting REPL on ubuntu 18.04 HOT 9
- Discrepancy in pom.xml dependencies and uberjar included dependencies HOT 12
- mktemp failed because it makes assumptions about /tmp HOT 9
- Bump Clojure to 1.11 HOT 1
- Looking to Build Leiningen from Source HOT 6
- lein deps hangs and exits due to StackOverflowError HOT 2
- Moving the repository to a new host HOT 13
- Lein uberjar producing different results to jar in different environments ( Ubuntu vs. OS X ) HOT 5
- Leiningen Homebrew 2.9.10 Upgrade Failing HOT 1
- Use :check-paths in check task if specified HOT 4
- CVE-2022-36033: Upgrade jsoup to version 1.15.3 HOT 3
- Leiningen 2.9.1 with java 7 HOT 2
- Add more versatile dependency/plugin resolution options (issue with plugin resolution order) HOT 1
- test-paths are included on classpath when building uberjar HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leiningen.