简体   繁体   English

Leiningen可以直接从Maven安装(并允许我的Clojure项目使用)Java软件包吗?

[英]Can Leiningen install (and let my Clojure project use) Java packages directly from Maven?

I'm not used to the Java / Maven ecosystem, but I'm happy using the Clojure / Leiningen / Clojars one. 我不习惯Java / Maven生态系统,但很高兴使用Clojure / Leiningen / Clojars。

So can I simply put the name of a package from Maven.org in my project.clj file, the way I'd put a clojar reference? 所以我可以简单地将Maven.org中的软件包名称放在我的project.clj文件中吗,就像我放置clojar引用一样? Or is there more to it? 还是还有更多呢?

The short answer - yes. 简短的答案-是的。

Read about Maven coordinates to understand terminology - artifacts, groups and versions. 阅读有关Maven坐标的信息,以了解术语-工件,组和版本。 It is common with Leiningen - see here . 莱宁根很常见-见这里

And yes, you just put package coordinates from Maven to project.clj and off you go. 是的,您只需将包坐标从Maven放到project.clj然后就可以使用了。 The translation is trivial. 翻译很简单。 If you have for example 如果你有例如

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

then in project.clj it will look like 然后在project.clj它将看起来像

:dependencies [[log4j/log4j "1.2.17"]]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM