NixOS / mvn2nix-maven-plugin

Generate project-info.json for use with nix's Maven repository generation functions
MIT License
31 stars 21 forks source link

project-info.json missing "authenticated" flag sometimes if dependency has already been fetched into local maven repository #5

Open trentonstrong opened 9 years ago

trentonstrong commented 9 years ago

My current workaround is to use the following one liner:

mvn -Dmaven.repo.local=mktemp -d -t mavenorg.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix

Profpatsch commented 8 years ago

Can confirm, for local dependencies that are not available online.

grahamc commented 8 years ago

Same here -- trying to build a project-info.json on a big project with no local repo is a bit painful.

lverns commented 7 years ago

The workaround given above does indeed work: mvn -Dmaven.repo.local=$(mktemp -d -t maven) org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix.

Could we change the title of this issue to something slightly more descriptive? e.g.

project-info.json missing "authenticated" flag sometimes if dependency has already been fetched into local maven repository.

kmdouglass commented 7 years ago

Unfortunately the workaround does not work for me. I've even tried deleting the default local Maven repository but have had no luck. I'd appreciate any help if someone knows what the problem is.

---EDIT---

I tested the workaround on my system with Maven 3.2.5 in addition to Maven 3.3.9, but am still getting the attribute 'authenticated' missing error.

kmdouglass:~$ uname -a
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux

kmdouglass:~$ mvn --version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.7.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"

kmdouglass:~$ nix-build ij2.nix  --show-trace 
error: while evaluating the attribute ‘args’ of the derivation ‘ImageJ’ at /home/kmdouglass/Desktop/workspace/ImageJ_Nix/ij2.nix:5:3:
while evaluating the attribute ‘text’ of the derivation ‘install.sh’ at /nix/store/6cgxclznakgrwxmccxyb9s5qcyax29rn-nixpkgs-17.09pre106045.7369fd0b51/nixpkgs/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute ‘buildPhase’ of the derivation ‘ij-1.51j.jar’ at /nix/store/6cgxclznakgrwxmccxyb9s5qcyax29rn-nixpkgs-17.09pre106045.7369fd0b51/nixpkgs/pkgs/build-support/build-maven.nix:60:5:
while evaluating the attribute ‘text’ of the derivation ‘settings.xml’ at /nix/store/6cgxclznakgrwxmccxyb9s5qcyax29rn-nixpkgs-17.09pre106045.7369fd0b51/nixpkgs/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute ‘buildCommand’ of the derivation ‘maven-repository’ at /nix/store/6cgxclznakgrwxmccxyb9s5qcyax29rn-nixpkgs-17.09pre106045.7369fd0b51/nixpkgs/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute ‘text’ of the derivation ‘build-maven-repository.sh’ at /nix/store/6cgxclznakgrwxmccxyb9s5qcyax29rn-nixpkgs-17.09pre106045.7369fd0b51/nixpkgs/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating anonymous function at /nix/store/6cgxclznakgrwxmccxyb9s5qcyax29rn-nixpkgs-17.09pre106045.7369fd0b51/nixpkgs/pkgs/build-support/build-maven.nix:17:31, called from undefined position:
attribute ‘authenticated’ missing, at /nix/store/6cgxclznakgrwxmccxyb9s5qcyax29rn-nixpkgs-17.09pre106045.7369fd0b51/nixpkgs/pkgs/build-support/build-maven.nix:17:39
copumpkin commented 7 years ago

This is causing trouble for me too

copumpkin commented 7 years ago

I think this is just caused by this line being hidden behind if (res.getRepository() instanceof RemoteRepository), which I guess is not always the case.

copumpkin commented 7 years ago

The better solution though is probably just to amend the builder in nixpkgs to not assume it's there. Something like .authenticated or false would probably be all that it takes. I'll experiment and maybe push up a fix.

joelthompson commented 7 years ago

The workaround also doesn't work for exhibitor, as it has two modules in the top-level project, exhibitor-core and exhibitor-standalone, the latter of which depends on the former, and so it'll always be a local repo.

datakurre commented 6 years ago

@copumpkin Did you manage to experiment with fixing missing "authenticated" as you mentioned in June?

ttuegel commented 6 years ago

I followed up with @copumpkin's suggestion of .authenticated or false, but I found that a large number of dependencies on this project (kframework/k) also do not specify url or sha1.

asymmetric commented 6 years ago

@ttuegel Is it dependencies of dependencies that have no url and sha1?

e.g. maven-install-plugin > maven-project