aleeusgr / hs-clojure

Other
0 stars 0 forks source link

Set up the project structure #5

Closed aleeusgr closed 3 months ago

aleeusgr commented 4 months ago

Docs: https://codeberg.org/leiningen/leiningen https://www.exoscale.com/syslog/clojure-application-tutorial/ https://clojars.org/search?q=artifact-id%3Alein-template* https://leiningen.org/tutorial.html

aleeusgr commented 3 months ago

Here are the steps to set up a new Clojure project using lein new:

Step 1: Install Leiningen

If you haven't already, install Leiningen by downloading the lein script from the Leiningen website and adding it to your system's PATH.

Step 2: Create a new project

Open a terminal and run the following command to create a new project:

lein new hs-clojure . --force

Replace myproject with the name of your project.

Step 3: Choose a template (optional)

If you want to create a project with a specific template, you can specify the template name after the project name. For example, to create a web project using the lein-new template, run:

lein new myproject +lein-new

This will create a new project with a basic directory structure and files for a web application.

Step 4: Change into the project directory

Change into the project directory:

cd myproject

Step 5: Explore the project structure

The project structure should look like this:

myproject/
project.clj
src/
myproject/
core.clj
test/
myproject/
core_test.clj
resources/
...

The project.clj file contains project metadata and dependencies. The src directory contains the source code, and the test directory contains test code. The resources directory contains static resources.

Step 6: Initialize the project

Run the following command to initialize the project:

lein deps

This will download and install the dependencies specified in the project.clj file.

Step 7: Start the REPL

Start the REPL (Read-Eval-Print Loop) by running:

lein repl

This will start a Clojure REPL where you can interactively evaluate Clojure code.

That's it! You now have a new Clojure project set up using lein new. You can start building your application by creating new files in the src directory and writing Clojure code.