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

  • SEARCH
  • Home
  • 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 3309598
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:39:36+00:00 2026-05-17T21:39:36+00:00

When you create a Clojure project with leiningen all the *.clj-files are compiled AOT.

  • 0

When you create a Clojure project with leiningen all the *.clj-files are compiled AOT. Normally the AOT compilation is not necessary and I would like to minimize it.

This is necessary for me to raise acceptance of Clojure as a complement in a Java-dominated environment. It is easier to “sell” a single class-file as the glue together with a couple of kB clj-files against the alternative of having 250+ kB class-files with strange names and hidden amongst them a little clj-file (which isn’t even read any more during execution).

Ideally the result of “lein compile” would be only a single small class file which (together with the clj-files and the clojure-library) implements the needed class-instance.

What is the easiest way to achieve this? I would prefer not to write a single line of Java (of course).

Update after feedback from technomancy

I do not suspect this being a leiningen problem. Let me explain what I am after with an example. Please forgive the length of the example. I am using leiningen 1.3.1 but I think 1.4.0-SNAPSHOOT behaves the same way.

$ lein new dummy
Created new project in: dummy
$ cd dummy

Now change project.clj to (added “:main dummy.core”):

(defproject dummy "1.0.0-SNAPSHOT"
  :description "FIXME: write"
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]]
  :main dummy.core)

and src/dummy/core.clj to:

(ns dummy.core
  (:gen-class))
(defn -main [& args]
  (println "This is Clojure code, args=" args))

Now compile it:

$ lein compile
Compiling dummy.core

This generates the following files in classes/dummy:

core.class
core__init.class
core$loading__4410__auto__.class
core$_main.class

This is all correct, I can execute the result:

$ java -cp lib/*:classes dummy.core Hello
This is Clojure code, args= (Hello)

Now comes what I want to have instead, but I do it manually:
I can delete all class-files except core.class and copy the core.clj into classes/dummy which now looks very empty:

$ ls classes/dummy/
core.class
core.clj

The core.class contains code to load the core.clj at runtime and the result is still the same, I still can do:

$ java -cp lib/*:classes dummy.core Hello
This is Clojure code, args= (Hello)

I can also modify core.clj (note: in classes/dummy!) and of course changes do not need to be recompiled.

Now my question boils down to this: Is there an easier way to get just this core.class?

  • 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-05-17T21:39:37+00:00Added an answer on May 17, 2026 at 9:39 pm

    Leiningen has done no AOT by default for quite some time now; perhaps you have an older version? But there is a new feature (in 1.4.0-SNAPSHOT) that ensures .class files created due to transitive AOT get deleted before jar creation, (see Clojure assembla #322) which may also interest you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To create a playlist for all of the music in a folder, I am
I create a new Button object but did not specify the command option upon
I have a clojure project that uses the slick 2d game engine that I
I've been using Clojure for a little while and want to create some projects
create table person ( name varchar(15), attr1 varchar(15), attr2 varchar(1), attr3 char(1), attr4 int
Create a flat text file in c++ around 50 - 100 MB with the
Create a file called Valid[File].txt and stick some text in it. Start powershell and
I create a web application (WAR) and deploy it on Tomcat. In the webapp
I create a GUID (as a string) and get the hash of it. Can
To create a new event handler on a control you can do this c.Click

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.