Fork me on GitHub
#tools-deps
<
2018-05-23
>
martinklepsch07:05:51

The error message when deps.edn’s parens aren’t balanced could be friendlier:

Error building classpath. EOF while reading
java.lang.RuntimeException: EOF while reading

kenny14:05:52

lein-tools-deps does not seem to be marking my src directory as a source root. I am using [lein-tools-deps "0.3.0-SNAPSHOT"] with :tools/deps set to [:system :home "/path/to/deps.edn"]. Has anyone else ran into this issue?

mhuebert15:05:26

@kenny I have hit this just in the last couple of days, setting up a monorepo with a bunch of directories which each have their own deps.edn. I ended up adding "src" to :paths in each deps.edn

kenny15:05:20

@mhuebert That is my exact situation and that solution did not work for me 😞

mhuebert15:05:53

hmm, I am trying to set up the repo on another machine now to do some more testing and getting a completely different error with lein-tools-deps

mattpro:chia MattPro$ lein pom
java.lang.NullPointerException: null
 at clojure.tools.deps.alpha.util.maven$make_session.invokeStatic (maven.clj:105)
    clojure.tools.deps.alpha.util.maven$make_session.invoke (maven.clj:102)
    clojure.tools.deps.alpha.extensions.maven$eval851$fn__853.invoke (maven.clj:74)
    clojure.lang.MultiFn.invoke (MultiFn.java:243)
    clojure.tools.deps.alpha$expand_deps.invokeStatic (alpha.clj:170)
    clojure.tools.deps.alpha$expand_deps.invoke (alpha.clj:152)
    clojure.tools.deps.alpha$resolve_deps.invokeStatic (alpha.clj:215)
    clojure.tools.deps.alpha$resolve_deps.invoke (alpha.clj:197)
    lein_tools_deps.plugin$resolve_deps.invokeStatic (plugin.clj:78)
    lein_tools_deps.plugin$resolve_deps.invoke (plugin.clj:69)
    lein_tools_deps.plugin$middleware.invokeStatic (plugin.clj:93)
    lein_tools_deps.plugin$middleware.invoke (plugin.clj:85)

mhuebert16:05:24

*figured out this was due to a too-old Leiningen version

mhuebert15:05:28

the line numbers on make_session make me think it is somehow not a recent version of tools.deps, though i just ran brew upgrade clojure

Alex Miller (Clojure team)15:05:22

this is a known issue with interpreting the paths for dependent repos

Alex Miller (Clojure team)15:05:30

or at least that’s my guess as to what you’re seeing

Alex Miller (Clojure team)15:05:56

setting :paths explicitly in each deps.edn should workaround it

mhuebert15:05:24

that workaround worked in my case

mhuebert15:05:11

are local paths skipped intentionally during pom-generation or is that just WIP?

mhuebert15:05:55

am doing a workaround currently, generating a project.clj for lein to use lein-tools-deps to generate a full pom which includes everything necessary for IntelliJ to figure out the project

Alex Miller (Clojure team)15:05:31

the first local path is added as the build source path, but I think that actually needs to be changed so it’s a resource path. I don’t think there’s actually a ticket right now about that

Alex Miller (Clojure team)15:05:52

if you can file a ticket to remind me (or a patch!) that would be helpful

mhuebert15:05:04

hmm. why would it be a resource path?

mhuebert15:05:54

I am comparing to what lein generates, it also makes <build><sourceDirectory>src</sourceDirectory> ... </build>

mhuebert15:05:06

that part seems to play well with intellij

mhuebert15:05:29

Skipping paths: _build
Skipping coordinate: #:local{:root reactive}
Skipping coordinate: #:local{:root triple-db}
Skipping coordinate: #:local{:root view}
Skipping coordinate: #:local{:root gesture}
Skipping coordinate: #:local{:root style}

mhuebert15:05:49

I am wondering what can/should done about ^^these sorts of paths & local deps

Alex Miller (Clojure team)15:05:48

oh, there is nothing that can be done about them - Maven has no concept of local deps

Alex Miller (Clojure team)15:05:34

so that’s never going to work

Alex Miller (Clojure team)15:05:05

I guess you could write a custom Maven wagon and use that, but I’m not going to do that

mhuebert15:05:50

it looks like lein pom uses a plugin (`build-helper-maven-plugin`) to add the local sources for those:

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>_build</source>
                <source>reactive/src</source>
                <source>triple-db/src</source>
                <source>view/src</source>
                <source>view/test</source>
                <source>gesture/src</source>
                <source>style/src</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

Alex Miller (Clojure team)16:05:11

yeah, I’m not going to use that

Alex Miller (Clojure team)16:05:44

you can add these to your pom manually if you like. -Spom will sync an existing pom, just updating the rest of it

mhuebert16:05:21

ok. at some point maybe intelliJ/cursive will support deps.edn directly

Alex Miller (Clojure team)16:05:31

I think he’s started on that

hagmonk19:05:26

ANN: I just updated depify so that it can work from a deps.edn alias, if anyone is interested: https://github.com/hagmonk/depify