metosin / pohjavirta

Fast & Non-blocking Clojure wrapper for Undertow
169 stars 8 forks source link

Build instructions #18

Open prepor opened 4 years ago

prepor commented 4 years ago

Hey. The project has some Java code, but no instructions on how to build it.

kanwei commented 4 years ago

Yeah I ran into the same problem - doesn't work from deps.edn

ikitommi commented 4 years ago

lein javac works, need to polish the build pipeline at some point.

prepor commented 4 years ago

@ikitommi there is no project.clj, how do you make it work? by manually creating some basic project.clj?

lein javac
Couldn't find project.clj, which is needed for javac
zharinov commented 4 years ago

Hey folks, here is the little alias which helped me to run server in the REPL:

;; build/pohjavirta/javac.clj
(ns pohjavirta.javac
  (:require [leiningen.javac]))

(defn -main [& args]
  (leiningen.javac/javac
    {:java-source-paths ["src"]
     :compile-path      "target"
     :dependencies      [['org.clojure/clojure (clojure-version)]]
}))
;; alias in deps.edn
;; ...
:javac {:extra-paths ["build"]
        :extra-deps  {org.clojure/clojure {:mvn/version "1.10.1"}
                      leiningen           {:mvn/version "2.9.1"}}
        :main-opts   ["-m" "pohjavirta.javac"]}
;; ...
dpsutton commented 4 years ago

i'm trying this and seeing:

dan@dan-mbp pohjavirta % clj -A:javac
Compiling 3 source files to target
src/pohjavirta/Util.java:3: error: package org.xnio does not exist
import org.xnio.Buffers;
               ^
src/pohjavirta/Util.java:17: error: cannot find symbol
        int size = (int) Buffers.remaining(payload);
                         ^
  symbol:   variable Buffers
  location: class Util
2 errors
Compilation of Java sources(lein javac) failed.
dan@dan-mbp pohjavirta %
bsless commented 3 years ago

I managed to start a repl with these minimal changes:

(defproject metosin/pohjavirta "stub"
  :java-source-paths ["src"]
  :dependencies
  [[org.clojure/clojure "1.10.1"]
   [io.undertow/undertow-core "2.0.29.Final"]])

Add "target/classes" to :paths

then run lein javac and start a repl normally.