【问题标题】:How do you specify the classpath with Leiningen?您如何使用 Leiningen 指定类路径?
【发布时间】:2014-07-06 00:44:05
【问题描述】:

在 Clojure 中,我有一个 Leiningen 项目,我的源代码在

/src/project/core.clj

我想为此添加一个子目录。例如。

/src/project/examples/example-one.clj

在我的 core.clj 文件中,我尝试从

中提取
project.examples.example-one

但 lein compile 仍然告诉我

Could not locate project/examples/example_one__init.class or project/examples/example_one.clj on classpath: 

如果您向主代码目录添加子目录,是否必须显式更新 project.clj 文件? (我没有看到那里明确给出了主代码目录本身。)

【问题讨论】:

    标签: clojure classpath leiningen


    【解决方案1】:

    如果您的命名空间包含破折号,则相应的文件应该包含下划线而不是那些破折号。你可以在这里阅读原因:

    why-does-clojure-convert-dashes-in-names-to-underscores-in-the-filesystem

    除非您添加不同的源代码,如 Java、Groovy 等...默认情况下 lein 将包含 src 文件夹中的所有命名空间。

    【讨论】:

      【解决方案2】:

      啊...文件名中好像不能有连字符?

      对于 Lisp 方言来说有点奇怪,现在我已经习惯在函数名称中使用连字符作为默认分隔符。

      【讨论】:

        猜你喜欢
        • 2022-06-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-12-05
        • 1970-01-01
        • 2013-03-26
        • 1970-01-01
        • 2011-08-31
        相关资源
        最近更新 更多