3

I'm developing a library that contains both Clojure and Java code, using Eclipse + Maven to manage the project.

I have a good set of JUnit tests that cover the Java portion of the code base, and also have a separate set of Clojure tests written using the standard clojure.test toolset.

Ideally I'd like to be able to run all tests simultaneously as part of the build process. I have the clojure-maven-plugin installed, but it still only seems to run the JUnit tests and ignores the Clojure ones.

How can I achieve this?

1 Answer 1

3

OK, I figured out how to do this myself with a little help from the information in the answers to this question on testing Clojure with Maven.

The trick was to add the following section to the pom.xml:

  <build>
    <plugins>
        <plugin>
            <groupId>com.theoryinpractise</groupId>
            <artifactId>clojure-maven-plugin</artifactId>
            <version>1.3.8</version>

            <executions>
                <execution>
                    <id>test-clojure</id>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>

    <testResources>
      <testResource>
        <directory>src/test/clojure</directory>
      </testResource>
    </testResources>
  </build>

This has the effect of running the Clojure test cases as part of the standard Maven test goal.

EDIT

As of 2012, a good alternative is to use cljunit to run the Clojure tests as part of a regular JUnit test suite.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.