Search code examples
clojureintellij-ideala-clojure

Clojure compiler error: No such file or directory


I'm trying to execute a simple Clojure Test from IntelliJ and "La Clojure" plugin.

When I try to compile the Clojure file (helloTest.clj) I get this error:

Clojure Compiler: java.io.IOException: No such file or directory, compiling:(/ABSOLUTEPATH/helloTest.clj:1)

But, when I check via terminal the absolute path, i can see that the helloTest.clj file exists.

So, how is it possible that compiler cannot found the file if it exists?

Just in case, I add the content of helloTest.clj file:

(ns com.nameofthepackage.helloTest
  (:use clojure.test))

(deftest test1
  (is (= 1 3)))

(deftest test2
  (is (= 2 2)))

Solution

  • Finally, I've found that was a Maven issue with the clojure plugin.

    I've added this configuration to the pom.xml, and then it worked.

    <plugin>
                    <groupId>com.theoryinpractise</groupId>
                    <artifactId>clojure-maven-plugin</artifactId>
                    <version>1.3.13</version>
                        <extensions>true</extensions>
                        <configuration>
                            <sourceDirectories>
                                <sourceDirectory>src/main/clojure</sourceDirectory>
                            </sourceDirectories>
                            <testSourceDirectories>
                                <sourceDirectory>src/test/clojure</sourceDirectory>
                            </testSourceDirectories>
                        </configuration>
                        <executions>
                            <execution>
                                <id>compile</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>test</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                            </execution>
                        </executions>
                </plugin>