Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mvnix generates incorrect repo entry for local repos #37

Open
ToxicFrog opened this issue Mar 7, 2020 · 2 comments
Open

mvnix generates incorrect repo entry for local repos #37

ToxicFrog opened this issue Mar 7, 2020 · 2 comments

Comments

@ToxicFrog
Copy link

I'm trying to package Airsonic. Airsonic includes in its repo jars for specific versions of various dependencies, and a pom.xml that points at them. Mavenix, however, rather than generating a pointer to the source checkout at nix-build time, instead points at wherever the source tree was when you ran mvnix-update:

$ git clone https://github.com/airsonic/airsonic.git
$ cd airsonic
$ git checkout v10.5.0
$ mvnix-init
$ nano default.nix
    # Necessary because the CVE checker relies on runtime fetches of dependencies which
    # don't work on Nix.
    MAVEN_OPTS = "-Ddependency-check.skip=true";
$ mvnix-update default.nix
$ cat default.nix
  ...
  "remotes": {
    "4thline-repo": "http://4thline.org/m2",
    "central": "https://repo.maven.apache.org/maven2",
    "jaudiotagger-repository": "https://dl.bintray.com/ijabz/maven",
    "local1": "file:///home/toxicfrog/src/airsonic/airsonic-main/../repo"
  },
  ...

If you use mvnix-init -S 'fetchGit ...' instead, it gives you a path in /run/user/ instead.

The former works fine for local builds (the latter stops working as soon as you reboot or the temp directory created by mavenix gets otherwise cleaned up), but isn't great for packaging. I believe I can work around this by making a separate package that only contains those jars, derived from the same source, and then pointing mavenix.lock at that, but this seems like something mavenix should be able to handle on its own.

@icetan
Copy link
Collaborator

icetan commented Mar 25, 2020

Hi,

haven't noticed this before, I'm just grabbing whatever remotes maven spits out.

Good catch!

Will see if I can translate local paths to nix paths maybe.

@ToxicFrog
Copy link
Author

In the meantime I did eventually figure out a workaround that is, I think, minimally gross:

mavenix.buildMaven rec {
  src = fetchGit { ... };  # or wherever your src comes from
  remotes = { local1 = "file://${src}/repo"; };  # replace local1 and the repo/ subpath as needed
  # ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants