title: Can lein run specific custom code after compiling everything else?
body: <p>I've been trying to work around the issue <a href="https://stackoverflow.com/questions/23365409/clojure-cant-import-javafx-classes-with-static-initializers">issue</a> of building a Clojure JavaFX project that is both compilable and interactive, while still being able to <code>import</code> and <code>proxy</code> classes that run static initialization.  I trying applying <a href="https://dev.clojure.org/jira/browse/CLJ-1714" rel="nofollow noreferrer">this patch</a> to 1.9.0-master-SNAPSHOT, but no luck.  </p>
  
  <p>So my workaround is to initialize the toolkit first, during the compilation step, by making it the first thing in the first dependency.  However, as mentioned   <a href="https://www.reddit.com/r/Clojure/comments/370zmg/using_clojure_with_javafx_and_making_an_uberjar/" rel="nofollow noreferrer">elsewhere</a>, this prevents the compile step from terminating, so I have to kill the toolkit for it to work.</p>
  
  <p>Currently I'm doing this with a thread that runs a 5 second timer, assuming 5s is enough time to compile other files in the same <code>lein...</code> invocation, but it's obviously not a good solution.</p>
  
  <p><strong>Question</strong>:</p>
  
  <p><strong>Is there a way to run arbitrary Clojure code as the last thing in a <code>lein compile</code>, <code>lein uberjar</code>, etc?</strong> </p>
  
  <p>For example, ensuring that some .clj file is the very last one to get compiled, or putting something in the project.clj file?  All it needs to do is run <code>(javafx.application.Platform/exit)</code> after everything is done compiling.  Searches for lein compilation order usually point to the ordering/sequencing of Clojure vs Java sources.</p>