defining a simple leinegen project
(defproject vessel-one "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.11.1"]
[org.springframework.boot/spring-boot-starter "3.1.0"]
[org.springframework.boot/spring-boot-starter-web "3.1.0"]
[org.springframework.boot/spring-boot-starter-test "3.1.0" :scope "test"]
[ch.qos.logback/logback-classic "1.4.7"]]
:java-source-paths ["java-src"]
:main ^:skip-aot vessel-one.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all
:jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})
project structure. The most important thing here is the java-src location
.
├── CHANGELOG.md
├── doc
│ └── intro.md
├── java-src
│ ├── HELP.md
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ ├── src
│ │ ├── main
│ │ │ ├── java
│ │ │ │ └── mfx
│ │ │ │ └── system
│ │ │ │ └── demo
│ │ │ │ ├── DemoApplication.java
│ │ │ │ ├── Galadriel
│ │ │ │ │ └── Galadriel.java
│ │ │ │ └── TargetController.java
│ │ │ └── resources
│ │ │ ├── application.properties
│ │ │ ├── static
│ │ │ └── templates
│ │ └── test
│ │ └── java
│ │ └── mfx
│ │ └── system
│ │ └── demo
│ │ └── DemoApplicationTests.java
│ └── target
│ ├── classes
│ │ ├── application.properties
│ │ └── mfx
│ │ └── system
│ │ └── demo
│ │ ├── DemoApplication.class
│ │ ├── Galadriel.class
│ │ └── TargetController.class
│ ├── generated-sources
│ │ └── annotations
│ ├── generated-test-sources
│ │ └── test-annotations
│ └── test-classes
│ └── mfx
│ └── system
│ └── demo
│ └── DemoApplicationTests.class
├── LICENSE
├── project.clj
├── README.md
├── resources
├── src
│ └── vessel_one
│ ├── core.clj
│ └── jv-src
├── target
│ ├── 3f811423
│ │ └── stale
│ │ └── leiningen.core.classpath.extract-native-dependencies
│ ├── classes
│ │ ├── META-INF
│ │ │ └── maven
│ │ │ └── vessel-one
│ │ │ └── vessel-one
│ │ │ └── pom.properties
│ │ └── mfx
│ │ └── system
│ │ └── demo
│ │ ├── DemoApplication.class
│ │ ├── DemoApplicationTests.class
│ │ ├── Galadriel
│ │ │ └── Galadriel.class
│ │ └── TargetController.class
│ ├── repl-port
│ ├── stale
│ │ └── leiningen.core.classpath.extract-native-dependencies
│ └── test
│ └── stale
│ └── leiningen.core.classpath.extract-native-dependencies
└── test
└── vessel_one
└── core_test.clj
52 directories, 30 files
(ns vessel-one.core
(:gen-class)
;; Import the Java class. We only need to specify the class name itself here.
(:import [mfx.system.demo.Galadriel Galadriel])
(:import [mfx.system.demo DemoApplication]))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World!")
;; Call the static 'Greetings' method on the Galadriel Java class.
;; In Clojure, you call static methods on Java classes using ClassName/methodName.
(Galadriel/Greetings))
(Galadriel/Greetings)
(DemoApplication/main (into-array String []))