Git Product home page Git Product logo

mvn2nix-maven-plugin's Introduction

mvn2nix

master

Generate project-info.json for use with nix's Maven repository generation functions.

Note: This is slower than anyone would like and not expected to be perfect. Please open issues if something isn't working for you!

Appears to require maven 3.2.5 to build locally.

Usage

mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix

System properties

  • mvn2nixOutputFile: Change the name of the file generated by mvn2nix

mvn2nix-maven-plugin's People

Contributors

asbachb avatar fzakaria avatar jerith666 avatar shlevy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mvn2nix-maven-plugin's Issues

Trouble with SHA-1 files

I'm trying to package the kframework project, which uses modules, and I'm seeing the following error:

[INFO] Reactor Summary:
[INFO]
[INFO] K Framework Tool Parent 1.0-SNAPSHOT ............... SUCCESS [ 54.947 s]
[INFO] K Framework KORE ................................... SUCCESS [  0.013 s]
[INFO] K Framework Tool Kernel ............................ SUCCESS [  0.017 s]
[INFO] K Framework KTree .................................. SUCCESS [  0.017 s]
[INFO] K Framework Ocaml Backend .......................... SUCCESS [  0.027 s]
[INFO] K Framework Java Backend ........................... SUCCESS [  0.005 s]
[INFO] K Framework Tool Distribution ...................... SUCCESS [  0.009 s]
[INFO] K Framework API 1.0-SNAPSHOT ....................... FAILURE [ 24.221 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:53 min
[INFO] Finished at: 2018-07-24T15:10:45+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nixos.mvn2nix:mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) on project api: Downloading SHA-1 for org.codehaus.plexus:plexus-utils:jar:2.0.4: File: https://s3.amazonaws.com/repo.runtime.verification/repository/internal/org/codehaus/plexus/plexus-utils/2.0.4/plexus-utils-2.0.4.jar.sha1 , ReasonPhrase:Not Found. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :api

The pom.xml defines two custom repos:

  <repositories>
    <repository>
      <id>runtime.verification</id>
      <name>Runtime Verification Repository</name>
      <url>https://s3.amazonaws.com/repo.runtime.verification/repository/internal</url>
      <snapshots><enabled>false</enabled></snapshots>
      <releases><enabled>true</enabled></releases>
    </repository>
    <repository>
      <id>runtime.verification.snapshots</id>
      <name>Runtime Verification Snapshot Repository</name>
      <url>https://s3.amazonaws.com/repo.runtime.verification/repository/snapshots</url>
      <snapshots><enabled>true</enabled></snapshots>
      <releases><enabled>false</enabled></releases>
    </repository>
  </repositories>

I suppose that those repos don't include the .sha1 files, and that that is what's causing this tool to fail.

What are possible workarounds?

Dependencies shared with mvn2nix itself do not have URLs in output

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).

NullPointerException when running the generator on the `openhab-distro` repository

  1. Checkout github:openhab/openhab-distro/00e00fa5bf105aa554ab2cf44e7a8cebfcd046bb;
  2. Run mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix -B

Observe mvn2nix fail with a NullPointerException.

Output
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] openHAB Distribution                                               [pom]
[INFO] openHAB Features                                                   [pom]
[INFO] openHAB Distro Feature                                         [feature]
[INFO] openHAB Distro Feature KAR                                         [kar]
[INFO] openHAB Add-ons                                                [feature]
[INFO] openHAB Distributions                                              [pom]
[INFO] openHAB Add-ons Aggregator                                         [kar]
[INFO] openHAB Demo                                                       [pom]
[INFO] openHAB Distribution                                    [karaf-assembly]
[INFO] openHAB Feature Verification                                       [pom]
[INFO] 
[INFO] -----------------------< org.openhab.distro:pom >-----------------------
[INFO] Building openHAB Distribution 4.0.0-SNAPSHOT                      [1/10]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ pom ---
[INFO] 
[INFO] ------------------< org.openhab.distro:pom-features >-------------------
[INFO] Building openHAB Features 4.0.0-SNAPSHOT                          [2/10]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ pom-features ---
[INFO] 
[INFO] ---------------------< org.openhab.distro:distro >----------------------
[INFO] Building openHAB Distro Feature 4.0.0-SNAPSHOT                    [3/10]
[INFO] ------------------------------[ feature ]-------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ distro ---
[INFO] 
[INFO] -------------------< org.openhab.distro:distro-kar >--------------------
[INFO] Building openHAB Distro Feature KAR 4.0.0-SNAPSHOT                [4/10]
[INFO] --------------------------------[ kar ]---------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ distro-kar ---
[INFO] 
[INFO] ---------------------< org.openhab.distro:addons >----------------------
[INFO] Building openHAB Add-ons 4.0.0-SNAPSHOT                           [5/10]
[INFO] ------------------------------[ feature ]-------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ addons ---
[INFO] 
[INFO] ----------------< org.openhab.distro:pom-distributions >----------------
[INFO] Building openHAB Distributions 4.0.0-SNAPSHOT                     [6/10]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ pom-distributions ---
[INFO] 
[INFO] -----------------< org.openhab.distro:openhab-addons >------------------
[INFO] Building openHAB Add-ons Aggregator 4.0.0-SNAPSHOT                [7/10]
[INFO] --------------------------------[ kar ]---------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ openhab-addons ---
[INFO] 
[INFO] ------------------< org.openhab.distro:openhab-demo >-------------------
[INFO] Building openHAB Demo 4.0.0-SNAPSHOT                              [8/10]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ openhab-demo ---
[INFO] 
[INFO] ---------------------< org.openhab.distro:openhab >---------------------
[INFO] Building openHAB Distribution 4.0.0-SNAPSHOT                      [9/10]
[INFO] ---------------------------[ karaf-assembly ]---------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ openhab ---
[INFO] 
[INFO] -----------------< org.openhab.distro:openhab-verify >------------------
[INFO] Building openHAB Feature Verification 4.0.0-SNAPSHOT             [10/10]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) @ openhab-verify ---
[WARNING] The POM for org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-tp:xml:features:4.0.0-20230219.162241-34 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for openHAB Distribution 4.0.0-SNAPSHOT:
[INFO] 
[INFO] openHAB Distribution ............................... SUCCESS [  0.112 s]
[INFO] openHAB Features ................................... SUCCESS [  0.003 s]
[INFO] openHAB Distro Feature ............................. SUCCESS [  0.035 s]
[INFO] openHAB Distro Feature KAR ......................... SUCCESS [  0.012 s]
[INFO] openHAB Add-ons .................................... SUCCESS [  0.002 s]
[INFO] openHAB Distributions .............................. SUCCESS [  0.002 s]
[INFO] openHAB Add-ons Aggregator ......................... SUCCESS [  0.002 s]
[INFO] openHAB Demo ....................................... SUCCESS [  0.003 s]
[INFO] openHAB Distribution ............................... SUCCESS [  0.004 s]
[INFO] openHAB Feature Verification ....................... FAILURE [ 39.629 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  40.894 s
[INFO] Finished at: 2023-02-20T19:43:06+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nixos.mvn2nix:mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) on project openhab-verify: Execution default-cli of goal org.nixos.mvn2nix:mvn2nix-maven-plugin:1.2.0:mvn2nix failed. NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :openhab-verify

Incorrect URL path composition in project-info.json

After running
mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix
I get erronous URLs with // in their paths.

      "authenticated": false,
      "url": "https://repo1.maven.org/maven2//org/parboiled/parboiled-core/1.1.4/parboiled-core-1.1.4.pom",
      "sha1": "62965822c34fe24b815e2ee75a5af58fc4e8b8a6",
      "relocations": []

Build extensions not found

mvn2nix does not consider build extensions such as found in kframework/k. As a result, attempting to build with buildMaven fails:

  [ERROR]   The project com.runtimeverification.k:parent:1.0-SNAPSHOT (/build/k/pom.xml) has 1 error
  [ERROR]     Unresolveable build extension: Plugin org.springframework.build:aws-maven:5.0.0.RELEASE or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.springframework.build:aws-maven:jar:5.0.0.RELEASE has not been downloaded from it before. -> [Help 2]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
  [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginManagerException

I believe build extensions could be handled by extending the code that finds plugins, but my Java is weak.

Unable to build Spring Boot project

I am trying to build a Spring Boot project using this Maven plugin and buildMaven. No matter what I do, I never get all the dependencies into the maven repository and the offline build fails.

$ nix-shell
[nix-shell]$ $buildPhase
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for de.pg626:webshop:0.0.1-SNAPSHOT: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.3.RELEASE has not been downloaded from it before. and 'parent.relativePath' points at no local POM @ line 5, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project de.pg626:webshop:0.0.1-SNAPSHOT (/home/jonas/tu/PG/gc/backend/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for de.pg626:webshop:0.0.1-SNAPSHOT: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.3.RELEASE has not been downloaded from it before. and 'parent.relativePath' points at no local POM @ line 5, column 13 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Here is the pom.xml:

<?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath />
        <!-- lookup parent from repository -->
    </parent>
    <groupId>de.pg626</groupId>
    <artifactId>webshop</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>webshop</name>
    <description>a social webshop</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
	        <groupId>org.springframework.boot</groupId>
	        <artifactId>spring-boot-starter-tomcat</artifactId>
		</dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
		  	<groupId>com.paypal.sdk</groupId>
		    <artifactId>rest-api-sdk</artifactId>
		    <version>1.14.0</version>		    
		</dependency>
		<dependency>
		    <groupId>com.paypal.sdk</groupId>
		    <artifactId>paypal-core</artifactId>
		    <version>1.7.2</version>
		</dependency>
		<dependency>
		    <groupId>com.paypal.sdk</groupId>
		    <artifactId>checkout-sdk</artifactId>
		    <version>1.0.0</version>
		</dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
            <version>5.2.4</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>**/*_*.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>5.0.0-M3</version>
                <configuration>
                    <failBuildOnCVSS>11</failBuildOnCVSS>
                    <format>JSON</format>
                    <jarAnalyzerEnabled>true</jarAnalyzerEnabled>
                    <nuspecAnalyzerEnabled>false</nuspecAnalyzerEnabled>
                    <archiveAnalyzerEnabled>false</archiveAnalyzerEnabled>
                    <centralAnalyzerEnabled>false</centralAnalyzerEnabled>
                    <ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>
                    <nexusAnalyzerEnabled>false</nexusAnalyzerEnabled>
                    <artifactoryAnalyzerEnabled>false</artifactoryAnalyzerEnabled>
                    <pyDistributionAnalyzerEnabled>false</pyDistributionAnalyzerEnabled>
                    <pyPackageAnalyzerEnabled>false</pyPackageAnalyzerEnabled>
                    <rubygemsAnalyzerEnabled>false</rubygemsAnalyzerEnabled>
                    <opensslAnalyzerEnabled>false</opensslAnalyzerEnabled>
                    <cmakeAnalyzerEnabled>false</cmakeAnalyzerEnabled>
                    <autoconfAnalyzerEnabled>false</autoconfAnalyzerEnabled>
                    <composerAnalyzerEnabled>false</composerAnalyzerEnabled>
                    <nodeAnalyzerEnabled>false</nodeAnalyzerEnabled>
                    <retireJsAnalyzerEnabled>false</retireJsAnalyzerEnabled>
                    <nugetconfAnalyzerEnabled>false</nugetconfAnalyzerEnabled>
                    <cocoapodsAnalyzerEnabled>false</cocoapodsAnalyzerEnabled>
                    <bundleAuditAnalyzerEnabled>false</bundleAuditAnalyzerEnabled>
                    <!--> Gitlab CI-Server will add                    <dataDirectory></dataDirectory> Node here -->
                    <!--> Gitlab CI-Server will add                    <autoUpdate>false</autoUpdate> Node here -->
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

I generate the project-info.json with the following command:

$ mvn -Dmaven.repo.local=$(mktemp -d -t mavenXXX) org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix

My default.nix:

with import <nixpkgs> { };
(buildMaven ./project-info.json).build

It seems to me that the cause of the problem is the <parent> definition, I tried removing it but configuring all that Spring stuff by oneself is very complicated, I didn't figure out yet how to do that. And I'm not sure if I really want to do that :/ Any pointers or tips on how to debug this better are appreciated :)

Missing urls and auth when trying to process lp-etl

I'm trying mvn2nix with https://github.com/linkedpipes/etl but it doesn't seem to be processed correctly - I'm running this in the toplevel directory where pom.xml seems to include bunch of subprojects. Exploring the generated json I've found that e.g. vocabulary subpackage is missing an url. Also authenticated fields seems to be missing. I've found that there is a multiproject support, also tried workaround from #5.

Question: How to deal with Resource missing for a sh1 file (404)

I'm not experienced with maven at all, I'm just trying to package a project using maven for Nixpkgs. I ran:

mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix

Inside that project's clone and I encountered this error:

[INFO] PDFsam ............................................. SUCCESS [  0.204 s]
[INFO] PDFsam i18n ........................................ SUCCESS [  0.006 s]
[INFO] PDFsam core ........................................ SUCCESS [  0.006 s]
[INFO] PDFsam JavaFx views ................................ SUCCESS [  0.007 s]
[INFO] PDFsam service ..................................... SUCCESS [  0.007 s]
[INFO] PDFsam merge module ................................ SUCCESS [  0.008 s]
[INFO] PDFsam simple split module ......................... SUCCESS [  0.008 s]
[INFO] PDFsam split by size module ........................ SUCCESS [  0.011 s]
[INFO] PDFsam split by bookmarks module ................... SUCCESS [  0.015 s]
[INFO] PDFsam alternate mix module ........................ SUCCESS [  0.006 s]
[INFO] PDFsam rotate module ............................... SUCCESS [  0.006 s]
[INFO] PDFsam extract module .............................. SUCCESS [  0.009 s]
[INFO] PDFsam desktop client application .................. SUCCESS [  0.009 s]
[INFO] PDFsam Basic Edition application ................... SUCCESS [  0.060 s]
[INFO] PDFsam docs ........................................ FAILURE [  2.962 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.760 s
[INFO] Finished at: 2020-03-28T20:14:15+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nixos.mvn2nix:mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) on project pdfsam-docs: Downloading SHA-1 for org.sejda:sejda-model:test-jar:4.0.7: Resource missing at https://repo.maven.apache.org/maven2/org/sejda/sejda-model/4.0.7/sejda-model-4.0.7.test-jar.sha1 404 Not Found -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :pdfsam-docs

This is somewhat similar to NixOS/nixpkgs#19741 ... Is there anything I can do? Can I skip that 'project''s inclusion in project-info.json? I'm not sure I'm using the right terms but I'm refering to the failing "project" - pdfsam-docs.

Status of the repository?

Hi,

As part of NixOS/teams-collaboration#1, I am trying to clarify the status of the repositories under the NixOS organisation.

This repository seems to be unmaintained or obsolete, so it will be archived in a month.

If you think it warrants staying here or should be moved to another organization instead, please answer this issue.

Add sample nix expression in README

I wanted to fix the broken NixOS junit package but the README only describes how to generate the project-info.json file

I tried replacing the junit expression in all-packages.nix with

junit = buildMaven ../development/libraries/java/junit/project-info.json ;

and nix happily built the maven dependencies but unfortunately this did not build junit.

$ nix-build -A junit
these derivations will be built:
  /nix/store/xmzd1x46zv5yjp5wfp9qhkclgl7nycg2-junit-4.12.jar.drv
building path(s) ‘/nix/store/vzazijmzb9v7grxfrbdzmjc50ypslzin-junit-4.12.jar’
unpacking sources
unpacking source archive /nix/store/02x8ms0rwcfpgcifdav5na4c6bc2sinb-junit
source root is junit
patching sources
configuring
no configure script, doing nothing
building
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.049 s
[INFO] Finished at: 2015-10-03T22:09:43+00:00
[INFO] Final Memory: 7M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/tmp/nix-build-junit-4.12.jar.drv-0/junit). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
builder for ‘/nix/store/xmzd1x46zv5yjp5wfp9qhkclgl7nycg2-junit-4.12.jar.drv’ failed with exit code 1
error: build of ‘/nix/store/xmzd1x46zv5yjp5wfp9qhkclgl7nycg2-junit-4.12.jar.drv’ failed

Thanks in advance!

Support for version ranges

It seems version ranges are not working correctly. I have the following in pom.xml:

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>[1.7.1,1.7.99)</version>
    </dependency>

When I run mvn2nix, the following pops up in project-info.json:

        {
          "artifactId": "slf4j-api",
          "groupId": "org.slf4j",
          "version": "[1.7.1,1.7.99)",
          "classifier": "",
          "extension": "jar",
          "scope": "compile",
          "optional": false,
          "exclusions": []
        },

Eventually, buildMaven will generate a shell script that includes:

dir=$out/org/slf4j/slf4j-api/[1.7.1,1.7.99)

This will result in an error.

I have gone through the code to see how to force it to resolve all versions, but I'm a bit at a loss. I also do not seem to have a good way to debug the code. All suggestions are welcome.

with nixos-unstable duplicate metadata throws errors

due to potentially cyclic dependencies in the project.json file the build process errors with:

ln: failed to create symbolic link 'org/bukkit/bukkit/1.12.2-R0.1-SNAPSHOT/maven-metadata-spigotmc-repo.xml': File exists
error: builder for '/nix/store/10y4dxjk9k77zbqwpz40nbcgw61qv9bn-maven-repository.drv' failed with exit code 1;
       last 1 log lines:
       > ln: failed to create symbolic link 'org/bukkit/bukkit/1.12.2-R0.1-SNAPSHOT/maven-metadata-spigotmc-repo.xml': File exists
       For full logs, run 'nix log /nix/store/10y4dxjk9k77zbqwpz40nbcgw61qv9bn-maven-repository.drv'.
error: 1 dependencies of derivation '/nix/store/w4gkd03n7gisc8ffpnl8v7sqclkpycl0-harbor-1.6.4-b1.drv' failed to build

"authenticated" entry missing from some dependencies

I was trying to build the Spark Framework for NixOS, using this tool. Running mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix in a checkout of the 2.5.4 branch of the Spark repo produced a project-info.json file that is almost 1 MB.

I then attempted to use the JSON file to with the following function definition:

{ stdenv, buildMaven }:

let
  autoGeneratedDerivation = buildMaven /home/spark/project-info.json;
in
autoGeneratedDerivation

This produced the following error:

error: attribute ‘authenticated’ missing, at /nix/store/lwmgp564z0bl06svlnw21gg3qy8kw3vb-nixos-16.09.1512.6b28bd0/nixos/pkgs/build-support/build-maven.nix:17:39

The structure of the JSON is not yet documented (as per #2), but here is what I'm seeing. The JSON file is a map with two keys project and dependencies. The value associated with dependencies is an array of maps, with each map specifying a dependency. e.g.

{
    "artifactId": "maven-bundle-plugin",
    "groupId": "org.apache.felix",
    "version": "2.5.3",
    "classifier": "",
    "extension": "pom",
    "dependencies": [ CONTENT_OMITTED   ],
    "authenticated": false,
    "url": "https://repo.maven.apache.org/maven2/org/apache/felix/maven-bundle-plugin/2.5.3/maven-bundle-plugin-2.5.3.pom",
    "sha1": "2ce17ed65ebde5afd0b48781f89f2c372f990c17",
    "relocations": [ ]
}

However, some (around 20?) of these maps look different:

{
    "artifactId": "apache",
    "groupId": "org.apache",
    "version": "9",
    "classifier": "",
    "extension": "pom",
    "dependencies": [ ]
}

Thus the buildMaven function crashes when it tries to inherit the authenticated attributed from the parsed JSON.

If tried producing the project-info.json with both Maven 3.3.9 and 3.2.5, and this issue was in both outputs (although the outputs were slightly different). I'm running NixOS 16.09.

Is this just an instance of #5? I don't really understand what that issue is about.

If any more details are needed, I will do my best to provide them.

Error installing like specified in the readme

nix-shell> mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.238 s
[INFO] Finished at: 2016-03-11T18:45:58+01:00
[INFO] Final Memory: 8M/112M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nixos.mvn2nix:mvn2nix-maven-plugin:1.1.1:mvn2nix (default-cli): Goal requires a project to execute but there is no POM in this directory (/home/philip). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException

Handle private repos

If settings.xml has a username/password, need to use those for hash downloads.

Plugin doesn't construct the right path for `test-jar`

When I try to create repository-info.json for hadoop 2.10.2, I get this error:

[INFO] Apache Hadoop Azure Data Lake support .............. SUCCESS [  0.000 s]
[INFO] Apache Hadoop Tools Dist ........................... SUCCESS [  0.001 s]
[INFO] Apache Hadoop Tools ................................ SUCCESS [  0.001 s]
[INFO] Apache Hadoop Distribution ......................... SUCCESS [  0.010 s]
[INFO] Apache Hadoop Cloud Storage ........................ SUCCESS [  0.000 s]
[INFO] Apache Hadoop Cloud Storage Project ................ FAILURE [  0.728 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.075 s
[INFO] Finished at: 2022-09-27T15:34:20+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nixos.mvn2nix:mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) on project hadoop-cloud-storage-project: Downloading SHA-1 for org.apache.hadoop:hadoop-hdfs:test-jar:2.7.0: resource missing at https://repo.maven.apache.org/maven2/org/apache/hadoop/hadoop-hdfs/2.7.0/hadoop-hdfs-2.7.0.test-jar.sha1, status: 404 Not Found -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :hadoop-cloud-storage-project

The path that is being requested is wrong. There is no hadoop-hdfs-2.7.0.test-jar.sha1, but there is hadoop-hdfs-2.7.0-tests.jar.sha1.

The dependency in hadoop-project/pom.xml is this one:

      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-hdfs</artifactId>
        <version>${project.version}</version>
        <type>test-jar</type>
      </dependency>

Can generate dependencies with no url, causing failure in buildMaven

Using lein pom to generate a pom.xml for https://github.com/threatgrid/kiries, and then mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix, generates a project-info.json for which numerous dependencies have no URLs:

$ jq -r '.dependencies[] | select(.url? == null) | [.groupId, .artifactId, .version] | @tsv' <project-info.json | sort -u
org.apache	apache	10
org.apache	apache	5
org.apache.maven	maven-parent	11
org.apache.maven	maven-parent	21
org.apache.maven.wagon	wagon	1.0-beta-6
org.apache.maven.wagon	wagon-provider-api	1.0-beta-6
org.clojure	clojure	1.8.0
org.codehaus.plexus	plexus	2.0.7
org.codehaus.plexus	plexus	3.3.1
org.codehaus.plexus	plexus-component-annotations	1.5.5
org.codehaus.plexus	plexus-components	1.1.18
org.codehaus.plexus	plexus-containers	1.5.5
org.codehaus.plexus	plexus-interpolation	1.14
org.sonatype.oss	oss-parent	7
org.sonatype.spice	spice-parent	17

This is much shorter than the list of 858 unique dependencies which do have URLs, so it's a fairly small subset. However, the nixpkgs code intended to consume these JSON files is really quite unhappy when encountering one of them:

nix-repl> buildMaven ./project-info.json
error: attribute 'url' missing, at /nix/store/9yjrxr1b9c31xir2hm8xbp1mpbr2irhj-nixos-18.09.1420.5d4a1a3897e/nixos/pkgs/build-support/build-maven.nix:17:39

I suspect that we should be downloading only metadata, and not build artifacts, for these items.

Any pointers?

URLs have // and result in 404

When using this on a Clojure project I had to do the following after generating project-info.json:

sed -i 's|\(maven2/\)/|\1/|g'          project-info.json
sed -i 's|\(clojars\.org/repo\)/|\1|g' project-info.json

Misses some dependencies when run on K Framework

I am (re-)packaging a decently large Maven project – the K Framework – for Nix.
Currently, when I run this tool on that source, i.e.:

wget https://github.com/kframework/k/archive/master.zip
unzip master.zip; cd k-master
mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix
mv project-info.json ../kframework.json
cd ..; rm -r k-master

I get an output JSON file that does not contain the following dependency:

{
    "artifactId": "scala-maven-plugin",
    "groupId": "net.alchim31.maven",
    "version": "3.2.0",
    // ... omitted for brevity ...
    "exclusions": []
}

despite the fact that kore/pom.xml and tiny/pom.xml contain these lines:

<build>
  <plugins>
    <plugin>
      <groupId>net.alchim31.maven</groupId>
      <artifactId>scala-maven-plugin</artifactId>
      <version>3.2.0</version>
      <executions><!-- omitted for brevity --></executions>
      <configuration>
        <args><arg>-Xexperimental</arg></args>
      </configuration>
    </plugin>
  </plugins>
</build>

Sincerely,
Remy Goldschmidt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.