Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8433691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:27:29+00:00 2026-06-10T06:27:29+00:00

I got clojure project with ring library in it. This is project.clj: (defproject words

  • 0

I got clojure project with ring library in it. This is project.clj:

(defproject words "1.0.0-SNAPSHOT"
:description "Websocket handler for sessions"
:dependencies [[org.clojure/clojure "1.4.0"]
  [org.clojure/clojure-contrib "1.2.0"]
  [aleph "0.3.0-alpha1"]
  [org.clojure/data.json "0.1.2"]
  [clj-redis "0.0.13-SNAPSHOT"]
  [compojure "0.6.2"]
  [clj-http "0.1.3"]]
:main words.play
;; Lein ring plugin will provide `lein ring server` functionality
;; (and some other relative to ring actions)
:plugins [[lein-ring "0.6.6"]]
:ring {:handler words.api/engine})

In development environment I run it with 2 commands:
lein run server
lein ring server
and it’s works.

For production environment I want to minimize dependencies and build it into standalone jar with:

lein uberjar

How can I build it and run both of servers from one jar file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:27:30+00:00Added an answer on June 10, 2026 at 6:27 am

    Regarding to

    :main words.play
    

    I advice you to implement -main function in words.play something like

    (defn -main [& args]
      (case (first args)
        "server1" (do (println "Starting server1") (start-server1))
        "server2" (do (println "Starting server2") (start-server2))
        (println "Enter server name, pls")))
    

    Note, that :gen-class is necessary in namespace definition:

    (ns words.play
        (:gen-class))
    

    Implementation for start-server1 and start-server2 should depend on concrete frameworks: (run-jetty ...) for ring, (start-http-server ...) for aleph and so on (you can find more info in relative documentation).

    Usage:

    lein uberjar
    ## to start first server
    java -jar my-project-1.0.0-SNAPSHOT-standalone.jar server1
    ## to start second one
    java -jar my-project-1.0.0-SNAPSHOT-standalone.jar server2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the book Programming Clojure(Stuart), when read how macros are expanded I got confused.
Got this error message while trying to load view: The model item passed into
Got a question for some jQuery wizard who might stumble upon this. When I
got a problem, can't get my head around this jquery and would appreciate your
I am just starting out learning Clojure and Emacs. I have got Clojure Box
I have asked this question on twitter as well the #clojure IRC channel, yet
I've created file hello.clj (ns clojure.examples.hello (:gen-class)) (defn -main [greetee] (println (str Hello greetee
I am using emacs + slime for clojure development. Recently we got a new
Are there any docs on using slimv with clojure? I got it connected to
When I run the web application in the ring jetty server, I got EOF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.