Leiningen equivalent for maven dependency `type` element

[亡魂溺海] 提交于 2021-02-07 07:27:40

问题


I'm trying to follow this java tutorial for neo4j testing, but in Clojure. I'm using Leiningen for my dependency management, but that tutorial uses maven. According to the tutorial, maven would take the following dependency XML:

<dependencies>
  <dependency>
   <groupId>org.neo4j</groupId>
   <artifactId>neo4j-kernel</artifactId>
   <version>2.0.0</version>
   <type>test-jar</type>
   <scope>test</scope>
  </dependency>
  ...
</dependencies>

It also says:

Observe that the test-jar is crucial. Without it you would get the common neo4j-kernel jar, not the one containing the testing facilities.

I was wondering what the equivalent to this would be in my Leiningen project.clj? Obviously the main bit of it is [org.neo4j/neo4j-kernel "2.0.0"] but how do I encode the type parameter?

I've tried [org.neo4j/neo4j-kernel "2.0.0" :type "test-jar"] but that didn't work (and when I tried using :type "blah" it didn't throw an error, so I guess that parameter is ignored by Leiningen). I've also tried using :extension and :scope but again, these didn't work.


回答1:


Turns out the :classifier option is what I wanted:

[org.neo4j/neo4j-kernel "2.0.0" :classifier "tests"]



回答2:


:extension corresponds to the 'type' attribute e.g.

[org.somegroup/artifact "0.1.2" :extension "pom"]


来源:https://stackoverflow.com/questions/20790713/leiningen-equivalent-for-maven-dependency-type-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!