mvn2nix-maven-plugin icon indicating copy to clipboard operation
mvn2nix-maven-plugin copied to clipboard

Dependencies shared with mvn2nix itself do not have URLs in output

Open charles-dyfis-net opened this issue 5 years ago • 5 comments

Given the following POM:

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>mvnTest</groupId>
  <artifactId>mvnTest</artifactId>
  <packaging>jar</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>mvnTest</name>
  <description>A demonstration</description>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <directory>target</directory>
    <outputDirectory>target/classes</outputDirectory>
    <plugins/>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>tools.reader</artifactId>
      <version>0.10.0</version>
    </dependency>
  </dependencies>
</project>

...the generated project-info.json references several artifacts which are not given URLs:

$ mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix &>/dev/null && jq -r '.dependencies[] | select(.url? == null) | [.groupId, .artifactId, .version, .extension] | join(":")' <project-info.json
org.apache.maven:maven-parent:21:pom
org.apache:apache:10:pom
org.sonatype.oss:oss-parent:7:pom
org.sonatype.spice:spice-parent:17:pom
org.codehaus.plexus:plexus-interpolation:1.14:jar
org.codehaus.plexus:plexus-interpolation:1.14:pom
org.codehaus.plexus:plexus-component-annotations:1.5.5:jar
org.codehaus.plexus:plexus:3.3.1:pom
org.apache.maven:maven-parent:11:pom
org.apache:apache:5:pom
org.codehaus.plexus:plexus-components:1.1.18:pom
org.codehaus.plexus:plexus:2.0.7:pom
org.apache.maven.wagon:wagon:1.0-beta-6:pom
org.codehaus.plexus:plexus-component-annotations:1.5.5:pom
org.codehaus.plexus:plexus-containers:1.5.5:pom
org.apache.maven.wagon:wagon-provider-api:1.0-beta-6:jar
org.apache.maven.wagon:wagon-provider-api:1.0-beta-6:pom

This is a strict subset of the dependency tree of the mvn2nix plugin itself, as shown by the following code:

(cd ~/VC/mvn2nix-maven-plugin &&
  mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix >&2 &&
  { jq -r '.dependencies[] | [.groupId, .artifactId, .version, .extension] | join(":")' | sort; } <project-info.json >all-deps.txt
)
(cd ~/VC/mvnTest &&
  mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix >&2 &&
  { jq -r '.dependencies[] | select(.url? == null) | [.groupId, .artifactId, .version, .extension] | join(":")' | sort; } <project-info.json >no-url-deps.txt
)
comm -13 ~/VC/mvn2nix-maven-plugin/all-deps.txt ~/VC/mvnTest/no-url-deps.txt

...which returns 0 (as the number of lines in no-url-deps.txt but not also in all-deps.txt).

charles-dyfis-net avatar Nov 29 '18 22:11 charles-dyfis-net