title: Trying to create maven dynamic web project in eclipse with java and clojure
body: <p>I have created maven-archetype-webapp project in Eclipse. And I want to use Clojure code in Java.
  So, there is my core.clj file:</p>
  
  <pre><code>(ns coq.core
   (:gen-class
     :name coq.core
      :methods [#^{:static true} [foo [int] void]]))
  
  (defn -foo [i] (println "Hello from Clojure. My input was " i))
  
  (defn -main [] (println "Hello from Clojure -main." ))
  </code></pre>
  
  <p>pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;gleboGroup&lt;/groupId&gt;
  &lt;artifactId&gt;javaandclojure&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;javaandclojure Maven Webapp&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;3.8.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.1-b02&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.clojure&lt;/groupId&gt;
          &lt;artifactId&gt;clojure&lt;/artifactId&gt;
          &lt;version&gt;1.3.0&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;finalName&gt;javaandclojure&lt;/finalName&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.theoryinpractise&lt;/groupId&gt;
              &lt;artifactId&gt;clojure-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.3.10&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;sourceDirectories&gt;
                      &lt;sourceDirectory&gt;src/main/clojure&lt;/sourceDirectory&gt;
                  &lt;/sourceDirectories&gt;
                  &lt;testSourceDirectories&gt;
                      &lt;testSourceDirectory&gt;src/test/clojure&lt;/testSourceDirectory&gt;
                  &lt;/testSourceDirectories&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;compile&lt;/id&gt;
                      &lt;phase&gt;compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;compile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
                  &lt;execution&gt;
                      &lt;id&gt;test&lt;/id&gt;
                      &lt;phase&gt;test&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;test&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.2&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;default-compile&lt;/id&gt;
                      &lt;phase&gt;compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;compile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
                  &lt;execution&gt;
                      &lt;id&gt;default-testCompile&lt;/id&gt;
                      &lt;phase&gt;test-compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;testCompile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>There is my single servlet with error on core.foo(123):</p>
  
  <pre><code>package com.javaandclojure;
  
  import java.io.IOException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.ServletException;
  import javax.servlet.http.*;
  
  import coq.*;
  
  @WebServlet({ "/*"})
  public class Main extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      protected void doGet(HttpServletRequest request,
              HttpServletResponse response) throws ServletException, IOException {
          System.out.println("inside get!");
          core.foo(123);// core cannot be resolved
          request.setAttribute("number", 42);
          request.getRequestDispatcher("/index.jsp").forward(request, response);
      }
  }
  </code></pre>
  
  <p>Some scrinshots from eclipse:</p>
  
  <p><img src="https://i.stack.imgur.com/YkYxO.png" alt="enter image description here"></p>
  
  <p>build path:</p>
  
  <p><img src="https://i.stack.imgur.com/ttwAw.png" alt="enter image description here"></p>
  
  <p>Maven Build with goals:" clean package" gives it:</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building javaandclojure Maven Webapp 0.0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ javaandclojure ---
  [INFO] Deleting D:\porn\indigo\javaandclojure\target
  [INFO] 
  [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ javaandclojure ---
  [WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent!
  [INFO] Copying 0 resource
  [INFO] 
  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ javaandclojure ---
  [WARNING] File encoding has not been set, using platform encoding Cp1251, i.e. build is platform dependent!
  [INFO] Compiling 1 source file to D:\porn\indigo\javaandclojure\target\classes
  [INFO] -------------------------------------------------------------
  [ERROR] COMPILATION ERROR : 
  [INFO] -------------------------------------------------------------
  [ERROR] \porn\indigo\javaandclojure\src\main\java\com\javaandclojure\Main.java:[10,10] error: package coq does not exist
  [ERROR] \porn\indigo\javaandclojure\src\main\java\com\javaandclojure\Main.java:[17,2] error: cannot find symbol
  [INFO] 2 errors 
  [INFO] -------------------------------------------------------------
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 2.042s
  [INFO] Finished at: Sun Nov 11 16:28:25 EET 2012
  [INFO] Final Memory: 8M/20M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project javaandclojure: Compilation failure: Compilation failure:
  [ERROR] \porn\indigo\javaandclojure\src\main\java\com\javaandclojure\Main.java:[10,10] error: package coq does not exist
  [ERROR] \porn\indigo\javaandclojure\src\main\java\com\javaandclojure\Main.java:[17,2] error: cannot find symbol
  [ERROR] -&gt; [Help 1]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  </code></pre>
  
  <p>Maybe I should have used another maven archetype?</p>