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

Add JDK8 support #19

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Add JDK8 support #19

wants to merge 7 commits into from

Conversation

fzakaria
Copy link
Owner

@bbigras opened an issue trying to run mvn2nix on jasperstarter.

The jasperstarter project actually demonstrated a few key defecits in mvn2nix that this pull-request resolves.

  1. The project requires the awt libraries (user interfaces); which are not included with the headless distribution that I was bundling. Change all the JDK to the full installation by default.

  2. The Maven project could not be built using JDK11 which was the default JRE version that mvn2nix uses to execute Maven. Introduce separate mvn2nix derivations that use jdk8 or jdk11

Fixes #18

CC
@roberth
@DerGuteMoritz

@fzakaria
Copy link
Owner Author

fzakaria commented Aug 27, 2020

@bbigras I was able to run it on your project with these changes

mvn2nix --repositories https://jaspersoft.jfrog.io/jaspersoft/jr-ce-releases \
        --repositories https://repo.maven.apache.org/maven2 \
        --repositories http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts

dependencies.nix

{
  "org.codehaus.plexus:plexus-utils:pom:3.0.10" = {
    url = "https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.10/plexus-utils-3.0.10.pom";
    layout = "org/codehaus/plexus/plexus-utils/3.0.10/plexus-utils-3.0.10.pom";
    sha256 = "1f4ed909a012a1ae3eec7b649ae84c0425a05cbb05c48b6a644d122fb6f6bc4b";
  };
  "org.codehaus.plexus:plexus-utils:pom:1.5.12" = {
    url = "https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.5.12/plexus-utils-1.5.12.pom";
    layout = "org/codehaus/plexus/plexus-utils/1.5.12/plexus-utils-1.5.12.pom";
    sha256 = "e19904ff8efdb12c13ee2dcc2d457be0222823ca951513ccc7cbe266a85b8f1a";
  };
  "org.codehaus.plexus:plexus-utils:pom:1.5.10" = {
    url = "https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.5.10/plexus-utils-1.5.10.pom";
    layout = "org/codehaus/plexus/plexus-utils/1.5.10/plexus-utils-1.5.10.pom";
    sha256 = "9be820d5ca41ec23179bf1a8bd8ff4b79e0b390b1c3fe9926153de54103b6dcb";
  };

Comment on lines +29 to +34
If your build builds only with **Java8** (the deafult is Java11); you can execute the alternative
*mvn2nix* attribute.

```bash
$ nix run -f https://github.com/fzakaria/mvn2nix/archive/master.tar.gz mvn2nix-jdk8 --command mvn2nix
```
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbigras You will have to run the JDK8 command here.

Maven only sets JAVA_HOME if its not set.

I suspect that GitHub actions are setting JAVA_HOME; so it's
not getting the JDK11 version and failing to build.
@@ -0,0 +1 @@
use nix
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added direnv; unrelated to the fix.

@@ -14,6 +14,6 @@ jobs:
with:
name: fzakaria
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-build
- run: nix-build -A mvn2nix
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure we build the JDK11 version

@@ -28,7 +28,7 @@ in mkDerivation rec {
mkdir -p $out/bin

# create a symbolic link for the lib directory
ln -s ${mavenRepository}/.m2 $out/lib
ln -s ${mavenRepository} $out/lib
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this was a bug;
I'll running this to the github actions afterwards.

Comment on lines 18 to +19
name = "mvn2nix-shell";
buildInputs = with pkgs; [ jdk11_headless maven gh-md-toc];
buildInputs = with pkgs; [ jdk11_headless maven gh-md-toc ];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nixfmt formatting

@fzakaria
Copy link
Owner Author

@bbigras if you want to confirm; i can then merge it in.

@bbigras
Copy link

bbigras commented Aug 27, 2020

Sorry I have been trying but I must be doing something wrong.

nix run -f https://github.com/fzakaria/mvn2nix/archive/41cc1c464350af2afb9db151b6642de7b7f96540.tar.gz \
          mvn2nix-jdk8 --command mvn2nix --repositories https://jaspersoft.jfrog.io/jaspersoft/jr-ce-releases \
        --repositories https://repo.maven.apache.org/maven2 \
        --repositories http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts
[...]
2020-08-27 00:00:49,147 [Thread-1] WARN : [INFO] ------------------------------------------------------------------------
2020-08-27 00:00:49,147 [Thread-1] WARN : [INFO] BUILD FAILURE
2020-08-27 00:00:49,148 [Thread-1] WARN : [INFO] ------------------------------------------------------------------------
2020-08-27 00:00:49,148 [Thread-1] WARN : [INFO] Total time:  01:34 min
2020-08-27 00:00:49,150 [Thread-1] WARN : [INFO] Finished at: 2020-08-27T00:00:49-04:00
2020-08-27 00:00:49,150 [Thread-1] WARN : [INFO] ------------------------------------------------------------------------
2020-08-27 00:00:49,150 [Thread-1] WARN : [ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:1.7.24:launch4j (l4j-cli) on project jasperstarter: Failed to build the executable; please verify your configuration. net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "/tmp/mvn2nix9804342129636792631/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres": error=2, No such file or directory -> [Help 1]
2020-08-27 00:00:49,150 [Thread-1] WARN : [ERROR]
2020-08-27 00:00:49,151 [Thread-1] WARN : [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
2020-08-27 00:00:49,151 [Thread-1] WARN : [ERROR] Re-run Maven using the -X switch to enable full debug logging.
2020-08-27 00:00:49,151 [Thread-1] WARN : [ERROR]
2020-08-27 00:00:49,151 [Thread-1] WARN : [ERROR] For more information about the errors and possible solutions, please read the following articles:
2020-08-27 00:00:49,151 [Thread-1] WARN : [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Failed to execute goals [[package]]. Exit code: 1

@bbigras
Copy link

bbigras commented Aug 27, 2020

I could paste more of the log.

@fzakaria
Copy link
Owner Author

You might have to; I just ran the command you linked and it completed locally.

nix run -f https://github.com/fzakaria/mvn2nix/archive/41cc1c464350af2afb9db151b6642de7b7f96540.tar.gz \
          mvn2nix-jdk8 --command mvn2nix --repositories https://jaspersoft.jfrog.io/jaspersoft/jr-ce-releases \
        --repositories https://repo.maven.apache.org/maven2 \
        --repositories http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts

@bbigras
Copy link

bbigras commented Aug 27, 2020

[...]
2020-08-27 00:14:22,253 [Thread-1] WARN : [INFO] Downloaded from central: https://repo.maven.apache.org/maven2/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64.jar (4.0 MB at 3.0 MB/s)
2020-08-27 00:14:22,383 [Thread-1] WARN : [INFO] launch4j: Compiling resources
2020-08-27 00:14:22,387 [Thread-1] WARN : [INFO] launch4j: Generated resource file...
2020-08-27 00:14:22,387 [Thread-1] WARN : 
2020-08-27 00:14:22,387 [Thread-1] WARN : [INFO] launch4j: LANGUAGE 0, 1
2020-08-27 00:14:22,387 [Thread-1] WARN : 1 VERSIONINFO
2020-08-27 00:14:22,387 [Thread-1] WARN : FILEVERSION 0, 0, 0, 0
2020-08-27 00:14:22,387 [Thread-1] WARN : PRODUCTVERSION 0, 0, 0, 0
2020-08-27 00:14:22,387 [Thread-1] WARN : FILEFLAGSMASK 0
2020-08-27 00:14:22,387 [Thread-1] WARN : FILEOS 0x40000
2020-08-27 00:14:22,388 [Thread-1] WARN : FILETYPE 1
2020-08-27 00:14:22,388 [Thread-1] WARN : {
2020-08-27 00:14:22,388 [Thread-1] WARN :  BLOCK "StringFileInfo"
2020-08-27 00:14:22,388 [Thread-1] WARN :  {
2020-08-27 00:14:22,388 [Thread-1] WARN :   BLOCK "040904E4"
2020-08-27 00:14:22,388 [Thread-1] WARN :   {
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "CompanyName", "Cenote GmbH"
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "FileDescription", "JasperStarter 3.6.0-SNAPSHOT"
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "FileVersion", "3.6.0-SNAPSHOT"
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "InternalName", "jasperstarter"
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "LegalCopyright", "Copyright 2012 Cenote GmbH"
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "LegalTrademarks", ""
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "OriginalFilename", "jasperstarter.exe"
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "ProductName", "JasperStarter"
2020-08-27 00:14:22,388 [Thread-1] WARN :    VALUE "ProductVersion", "3.6.0-SNAPSHOT"
2020-08-27 00:14:22,388 [Thread-1] WARN :   }
2020-08-27 00:14:22,388 [Thread-1] WARN :  }
2020-08-27 00:14:22,388 [Thread-1] WARN : BLOCK "VarFileInfo"
2020-08-27 00:14:22,388 [Thread-1] WARN : {
2020-08-27 00:14:22,388 [Thread-1] WARN : VALUE "Translation", 0x0409, 0x04E4
2020-08-27 00:14:22,388 [Thread-1] WARN : }
2020-08-27 00:14:22,388 [Thread-1] WARN : }2 RCDATA BEGIN "1.8.0\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 18 RCDATA BEGIN "1\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 30 RCDATA BEGIN "2\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 10 RCDATA BEGIN "JasperStarter\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 21 RCDATA BEGIN "http://java.com/download\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 20 RCDATA BEGIN "32\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 101 RCDATA BEGIN "An error occurred while starting the application.\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 102 RCDATA BEGIN "This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 103 RCDATA BEGIN "This application requires a Java Runtime Environment\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 104 RCDATA BEGIN "The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 17 RCDATA BEGIN "true\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 15 RCDATA BEGIN "de.cenote.jasperstarter.App\0" END
2020-08-27 00:14:22,388 [Thread-1] WARN : 16 RCDATA BEGIN "argparse4j-0.5.0.jar;jcalendar-1.4.jar;rhino-1.7.7.2.jar;jasperreports-6.7.0.jar;commons-beanutils-1.9.3.jar;commons-collections-3.2.2.jar;commons-digester-2.1.jar;commons-logging-1.1.1.jar;itext-2.1.7.js6.jar;bcprov-jdk15on-1.52.jar;jcommon-1.0.23.jar;jfreechart-1.0.19.jar;ecj-4.4.2.jar;castor-xml-1.3.3.jar;castor-core-1.3.3.jar;javax.inject-1.jar;stax-1.2.0.jar;stax-api-1.0.1.jar;stax-api-1.0-2.jar;jackson-core-2.9.5.jar;jackson-databind-2.9.5.jar;jackson-annotations-2.9.5.jar;icu4j-57.1.jar;jasperreports-fonts-6.0.0.jar;jasperreports-functions-6.7.0.jar;joda-time-2.9.9.jar;jasperreports-chart-customizers-6.7.0.jar;jasperreports-chart-themes-6.7.0.jar;spring-beans-4.3.21.RELEASE.jar;spring-core-4.3.21.RELEASE.jar;spring-expression-4.3.21.RELEASE.jar;poi-3.17.jar;commons-codec-1.10.jar;commons-collections4-4.1.jar;batik-bridge-1.9.1.jar;batik-anim-1.9.1.jar;batik-parser-1.9.1.jar;batik-xml-1.9.1.jar;xml-apis-ext-1.3.04.jar;batik-gvt-1.9.1.jar;batik-util-1.9.1.jar;batik-constants-1.9.1.jar;batik-i18n-1.9.1.jar;batik-svg-dom-1.9.1.jar;batik-ext-1.9.1.jar;batik-dom-1.9.1.jar;xalan-2.7.2.jar;serializer-2.7.2.jar;xml-apis-1.3.04.jar;batik-script-1.9.1.jar;jython-2.7.0.jar;batik-css-1.9.1.jar;batik-svggen-1.9.1.jar;batik-awt-util-1.9.1.jar;xmlgraphics-commons-2.2.jar;barcode4j-2.1.jar;avalon-framework-impl-4.2.0.jar;commons-cli-1.0.jar;ant-1.7.1.jar;ant-launcher-1.7.1.jar;barbecue-1.5-beta1.jar;log4j-1.2.17.jar;groovy-all-2.4.12.jar;commons-io-2.5.jar;commons-lang-2.6.jar;servlet-api-2.5.jar;antlr-3.0b5.jar;stringtemplate-3.0.jar;antlr-2.7.7.jar;core-2.3.0.jar\0" END
2020-08-27 00:14:22,389 [Thread-1] WARN : 
2020-08-27 00:14:22,389 [Thread-1] WARN : [ERROR] 
2020-08-27 00:14:22,389 [Thread-1] WARN : net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "/tmp/mvn2nix12454577458638575810/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres": error=2, No such file or directory
2020-08-27 00:14:22,389 [Thread-1] WARN :     at net.sf.launch4j.Builder.build (Builder.java:149)
2020-08-27 00:14:22,389 [Thread-1] WARN :     at com.akathist.maven.plugins.launch4j.Launch4jMojo.doExecute (Launch4jMojo.java:431)
2020-08-27 00:14:22,389 [Thread-1] WARN :     at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute (Launch4jMojo.java:320)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at java.lang.reflect.Method.invoke (Method.java:498)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
2020-08-27 00:14:22,394 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
2020-08-27 00:14:22,395 [Thread-1] WARN : Caused by: net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "/tmp/mvn2nix12454577458638575810/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres": error=2, No such file or directory
2020-08-27 00:14:22,395 [Thread-1] WARN :     at net.sf.launch4j.Util.exec (Util.java:160)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at net.sf.launch4j.Cmd.exec (Builder.java:215)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at net.sf.launch4j.Builder.build (Builder.java:100)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at com.akathist.maven.plugins.launch4j.Launch4jMojo.doExecute (Launch4jMojo.java:431)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute (Launch4jMojo.java:320)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at java.lang.reflect.Method.invoke (Method.java:498)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
2020-08-27 00:14:22,395 [Thread-1] WARN : Caused by: java.io.IOException: Cannot run program "/tmp/mvn2nix12454577458638575810/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres": error=2, No such file or directory
2020-08-27 00:14:22,395 [Thread-1] WARN :     at java.lang.ProcessBuilder.start (ProcessBuilder.java:1048)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at java.lang.Runtime.exec (Runtime.java:621)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at java.lang.Runtime.exec (Runtime.java:486)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at net.sf.launch4j.Util.exec (Util.java:128)
2020-08-27 00:14:22,395 [Thread-1] WARN :     at net.sf.launch4j.Cmd.exec (Builder.java:215)
2020-08-27 00:14:22,396 [Thread-1] WARN :     at net.sf.launch4j.Builder.build (Builder.java:100)
2020-08-27 00:14:22,396 [Thread-1] WARN :     at com.akathist.maven.plugins.launch4j.Launch4jMojo.doExecute (Launch4jMojo.java:431)
2020-08-27 00:14:22,396 [Thread-1] WARN :     at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute (Launch4jMojo.java:320)
2020-08-27 00:14:22,396 [Thread-1] WARN :     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
2020-08-27 00:14:22,396 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
2020-08-27 00:14:22,396 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
2020-08-27 00:14:22,396 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at java.lang.reflect.Method.invoke (Method.java:498)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
2020-08-27 00:14:22,397 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
2020-08-27 00:14:22,398 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
2020-08-27 00:14:22,398 [Thread-1] WARN : Caused by: java.io.IOException: error=2, No such file or directory
2020-08-27 00:14:22,398 [Thread-1] WARN :     at java.lang.UNIXProcess.forkAndExec (Native Method)
2020-08-27 00:14:22,398 [Thread-1] WARN :     at java.lang.UNIXProcess.<init> (UNIXProcess.java:247)
2020-08-27 00:14:22,398 [Thread-1] WARN :     at java.lang.ProcessImpl.start (ProcessImpl.java:134)
2020-08-27 00:14:22,398 [Thread-1] WARN :     at java.lang.ProcessBuilder.start (ProcessBuilder.java:1029)
2020-08-27 00:14:22,398 [Thread-1] WARN :     at java.lang.Runtime.exec (Runtime.java:621)
2020-08-27 00:14:22,398 [Thread-1] WARN :     at java.lang.Runtime.exec (Runtime.java:486)
2020-08-27 00:14:22,401 [Thread-1] WARN :     at net.sf.launch4j.Util.exec (Util.java:128)
2020-08-27 00:14:22,401 [Thread-1] WARN :     at net.sf.launch4j.Cmd.exec (Builder.java:215)
2020-08-27 00:14:22,401 [Thread-1] WARN :     at net.sf.launch4j.Builder.build (Builder.java:100)
2020-08-27 00:14:22,401 [Thread-1] WARN :     at com.akathist.maven.plugins.launch4j.Launch4jMojo.doExecute (Launch4jMojo.java:431)
2020-08-27 00:14:22,401 [Thread-1] WARN :     at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute (Launch4jMojo.java:320)
2020-08-27 00:14:22,401 [Thread-1] WARN :     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
2020-08-27 00:14:22,401 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
2020-08-27 00:14:22,402 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
2020-08-27 00:14:22,403 [Thread-1] WARN :     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
2020-08-27 00:14:22,403 [Thread-1] WARN :     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2020-08-27 00:14:22,403 [Thread-1] WARN :     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
2020-08-27 00:14:22,403 [Thread-1] WARN :     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2020-08-27 00:14:22,405 [Thread-1] WARN :     at java.lang.reflect.Method.invoke (Method.java:498)
2020-08-27 00:14:22,405 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
2020-08-27 00:14:22,405 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
2020-08-27 00:14:22,405 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
2020-08-27 00:14:22,405 [Thread-1] WARN :     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
2020-08-27 00:14:22,406 [Thread-1] WARN : [INFO] ------------------------------------------------------------------------
2020-08-27 00:14:22,406 [Thread-1] WARN : [INFO] BUILD FAILURE
2020-08-27 00:14:22,406 [Thread-1] WARN : [INFO] ------------------------------------------------------------------------
2020-08-27 00:14:22,408 [Thread-1] WARN : [INFO] Total time:  01:34 min
2020-08-27 00:14:22,408 [Thread-1] WARN : [INFO] Finished at: 2020-08-27T00:14:22-04:00
2020-08-27 00:14:22,408 [Thread-1] WARN : [INFO] ------------------------------------------------------------------------
2020-08-27 00:14:22,409 [Thread-1] WARN : [ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:1.7.24:launch4j (l4j-cli) on project jasperstarter: Failed to build the executable; please verify your configuration. net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "/tmp/mvn2nix12454577458638575810/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres": error=2, No such file or directory -> [Help 1]
2020-08-27 00:14:22,410 [Thread-1] WARN : [ERROR] 
2020-08-27 00:14:22,410 [Thread-1] WARN : [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
2020-08-27 00:14:22,410 [Thread-1] WARN : [ERROR] Re-run Maven using the -X switch to enable full debug logging.
2020-08-27 00:14:22,410 [Thread-1] WARN : [ERROR] 
2020-08-27 00:14:22,410 [Thread-1] WARN : [ERROR] For more information about the errors and possible solutions, please read the following articles:
2020-08-27 00:14:22,410 [Thread-1] WARN : [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
�[31m�[1mFailed to execute goals [[package]]. Exit code: 1�[21m�[39m�[0m

@fzakaria
Copy link
Owner Author

fzakaria commented Aug 27, 2020

@bbigras
Weird. Does the file actually exist or just fail to run ?
Did you ls your temporary maven repository ?

Here is mine:

❯ ls -l /tmp/mvn2nix3157314594534710738/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres
.rwxr-xr-x 1.1M fmzakari 23 May  2018 /tmp/mvn2nix3157314594534710738/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres

I was able to run it even.

/tmp/mvn2nix3157314594534710738/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres --help | head

Usage: /tmp/mvn2nix3157314594534710738/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres [option(s)] [input-file] [output-file]
 The options are:
  -i --input=<file>            Name input file

@bbigras
Copy link

bbigras commented Aug 27, 2020

I tried again:

2020-08-27 00:33:43,396 [Thread-1] WARN : [ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:1.7.24:launch4j (l4j-cli) on project jasperstarter: Failed to build the executable; please verify your configuration. net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "/tmp/mvn2nix16572017359004825037/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres": error=2, No such file or directory -> [Help 1]
❯ ls -l /tmp/mvn2nix16572017359004825037/net/sf/launch4j/launch4j/3.12/launch4j-3.12-wor
kdir-linux64/bin/windres
.rwxr-xr-x 1,1M bbigras 23 mai  2018 /tmp/mvn2nix16572017359004825037/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres

❯ /tmp/mvn2nix16572017359004825037/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres
Failed to execute process '/tmp/mvn2nix16572017359004825037/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres'. Reason:
The file '/tmp/mvn2nix16572017359004825037/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres' does not exist or could not be executed.

❯ ldd /tmp/mvn2nix16572017359004825037/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres
        linux-vdso.so.1 (0x00007fff9b516000)
        libz.so.1 => not found
        libdl.so.2 => /nix/store/mh78fk3x12q2a77srgkzv16h0irl8r61-glibc-2.31/lib/libdl.so.2 (0x00007f7c0540c000)
        libc.so.6 => /nix/store/mh78fk3x12q2a77srgkzv16h0irl8r61-glibc-2.31/lib/libc.so.6 (0x00007f7c0524d000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/mh78fk3x12q2a77srgkzv16h0irl8r61-glibc-2.31/lib64/ld-linux-x86-64.so.2 (0x00007f7c05413000)

@fzakaria
Copy link
Owner Author

Interesting @bbigras. I take it your on NixOS ?
Looks like libz is part of zlib

$ nix-locate libz.so.1
...
zlib.out     0 s /nix/store/p1vgrfa31k73256nbrqsqcnvb9ij84lh-zlib-1.2.11/lib/libz.so.1

This project (jasperstarter) is a pretty complicated one; using dynamic libraries for Java.
Maybe you can prefix mvn2nix with the following:

LD_LIBRARY_PATH=$(nix-build '<nixpkgs>' -A zlib)/lib mvn2nix...

Sorry I don't have a really great answer at the moment; otherwise.
Best case if it works I will add a FAQ section

@fzakaria
Copy link
Owner Author

Here is my attempt locally to demonstrate what I mean

LD_LIBRARY_PATH=$(nix-build '<nixpkgs>' -A zlib)/lib nix run nixpkgs.glibc.bin --command ldd /tmp/mvn2nix3157314594534710738/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres
	linux-vdso.so.1 (0x00007ffd70b31000)
	/lib/x86_64-linux-gnu/libnss_cache.so.2 (0x00007fe9f446f000)
	libz.so.1 => /nix/store/41ps3rrqcs5xfpm3ckpvjrjbnrzi0w8x-zlib-1.2.11/lib/libz.so.1 (0x00007fe9f4452000)
	libdl.so.2 => /nix/store/aqq6367snc1zh3fs1pc4j4zm5h80vkkz-glibc-2.31/lib/libdl.so.2 (0x00007fe9f444d000)
	libc.so.6 => /nix/store/aqq6367snc1zh3fs1pc4j4zm5h80vkkz-glibc-2.31/lib/libc.so.6 (0x00007fe9f428e000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/aqq6367snc1zh3fs1pc4j4zm5h80vkkz-glibc-2.31/lib64/ld-linux-x86-64.so.2 (0x00007fe9f4478000)

@bbigras
Copy link

bbigras commented Aug 27, 2020

I take it your on NixOS ?

Yes

  • system: "x86_64-linux"
  • host os: Linux 5.7.10-zen1, NixOS, 20.09pre-git (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.7
  • channels(root): "nixos-20.09pre237686.96069f7d890"
  • nixpkgs: /run/current-system/nixpkgs
$ nix run -f https://github.com/fzakaria/mvn2nix/archive/41cc1c464350af2afb9db151b6642de7b7f96540.tar.gz           mvn2nix-jdk8 --command env LD_LIBRARY_PATH=$(nix-build '<nixpkgs>' -A zlib)/lib mvn2nix --repositories https://jaspersoft.jfrog.io/jaspersoft/jr-ce-releases         --repositories https://repo.maven.apache.org/maven2         --repositories http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts
2020-08-27 01:25:15,766 [Thread-1] WARN : [ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:1.7.24:launch4j (l4j-cli) on project jasperstarter: Failed to build the executable; please verify your configuration. net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "/tmp/mvn2nix9744882448265024330/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres": error=2, No such file or directory -> [Help 1]
$ LD_LIBRARY_PATH=$(nix-build '<nixpkgs>' -A zlib)/lib nix run nixpkgs.glibc.bin --command ldd /tmp/mvn2nix9744882448265024330/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres
	linux-vdso.so.1 (0x00007ffc4b5fb000)
	libz.so.1 => /nix/store/lxbxwg609cw3zby7ba78h0992hp9rcfy-zlib-1.2.11/lib/libz.so.1 (0x00007f2b3422f000)
	libdl.so.2 => /nix/store/mh78fk3x12q2a77srgkzv16h0irl8r61-glibc-2.31/lib/libdl.so.2 (0x00007f2b3422a000)
	libc.so.6 => /nix/store/mh78fk3x12q2a77srgkzv16h0irl8r61-glibc-2.31/lib/libc.so.6 (0x00007f2b3406b000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/mh78fk3x12q2a77srgkzv16h0irl8r61-glibc-2.31/lib64/ld-linux-x86-64.so.2 (0x00007f2b3424e000)

@fzakaria
Copy link
Owner Author

fzakaria commented Aug 27, 2020

@bbigras can you run winres itself with the LD_LIBRARY_PATH set (--help) ?
I ask because I always forget for java whether you have to set LD_LIBRARY_PATH or the system property java.library.path

@bbigras
Copy link

bbigras commented Aug 27, 2020

$ LD_LIBRARY_PATH=$(nix-build '<nixpkgs>' -A zlib)/lib /tmp/mvn2nix9744882448265024330/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres -h
bash: /tmp/mvn2nix9744882448265024330/net/sf/launch4j/launch4j/3.12/launch4j-3.12-workdir-linux64/bin/windres: No such file or directory

@fzakaria
Copy link
Owner Author

hmm we have departed a little from mvn2nix and just debugging this binary lol
I don't mind but maybe its faster to communicate on the discord NixOS server?

My next guess would be to strace to see why its failing.

@bbigras
Copy link

bbigras commented Aug 27, 2020

Since it's out of scope of mvn2nix and that I'm not a big fan of open source software using Discord, I'll just stop here.

Thank you very much for your time and help.

@fzakaria
Copy link
Owner Author

@bbigras fair enough.
I'll try later trying to get it to build inside a nix-shell

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

Successfully merging this pull request may close these issues.

can't generate dependencies for jasperstarter
2 participants