trustin / os-maven-plugin

A Maven plugin that sets various useful properties detected from ${os.name} and ${os.arch} properties.
Apache License 2.0
296 stars 66 forks source link

os.detected.arch: unknown; org.apache.maven.MavenExecutionException: unknown os.arch: riscv #51

Closed advancedwebdeveloper closed 3 years ago

advancedwebdeveloper commented 3 years ago

Hi there.

How about if your would some support for 64bit RISC-V hardware?

Here is what I am using:

$ java -version && javac -version openjdk version "11.0.8" 2020-07-14 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10-202007292333) Eclipse OpenJ9 VM AdoptOpenJDK (build master-dc7cbe4bd, JRE 11 Linux riscv-64-Bit Compressed References 20200729_78 (JIT disabled, AOT disabled) OpenJ9 - dc7cbe4bd OMR - 1c0299f20 JCL - 94b9d6d2c6 based on jdk-11.0.8+10) javac 11.0.8

on

$ uname -a && cat /proc/cpuinfo && cat /etc/release Linux test-gdams-debian10-riscv64-1.adoptopenjdk.net 5.0.0-rc1-56210-g0a657e0d72f0 #1 SMP Fri May 15 18:05:26 EDT 2020 riscv64 GNU/Linux processor : 0 hart : 1 isa : rv64imafdc mmu : sv39 uarch : sifive,rocket0

processor : 1 hart : 2 isa : rv64imafdc mmu : sv39 uarch : sifive,rocket0

processor : 2 hart : 3 isa : rv64imafdc mmu : sv39 uarch : sifive,rocket0

processor : 3 hart : 4 isa : rv64imafdc mmu : sv39 uarch : sifive,rocket0

PRETTY_NAME="Debian GNU/Linux bullseye/sid" NAME="Debian GNU/Linux" ID=debian .

Here is what I was doing:

~/hadoop/hadoop-hdfs-project$ mvn -e clean install -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true [INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Detecting the operating system and CPU architecture [INFO] ------------------------------------------------------------------------ [INFO] os.detected.name: linux [INFO] os.detected.arch: unknown [INFO] os.detected.version: 5.0 [INFO] os.detected.version.major: 5 [INFO] os.detected.version.minor: 0 [ERROR] unknown os.arch: riscv -> [Help 1] org.apache.maven.MavenExecutionException: unknown os.arch: riscv at kr.motd.maven.os.DetectExtension.afterProjectsRead (DetectExtension.java:95) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:264) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) . Exception seem to be raised at https://github.com/trustin/os-maven-plugin/blob/0d76872630d847db25d16bca8936f7c36fcc2170/src/main/java/kr/motd/maven/os/DetectExtension.java#L94 .

advancedwebdeveloper commented 3 years ago

I had to apply such a patch:

$ git diff diff --git a/src/main/java/kr/motd/maven/os/Detector.java b/src/main/java/kr/motd/maven/os/Detector.java index 377c6a1..b89131d 100644 --- a/src/main/java/kr/motd/maven/os/Detector.java +++ b/src/main/java/kr/motd/maven/os/Detector.java @@ -234,6 +234,9 @@ public abstract class Detector { if ("s390x".equals(value)) { return "s390_64"; }

  • if ("riscv".equals(value)) {
  • return "riscv";
  • }

     return UNKNOWN;

    }

, for https://github.com/trustin/os-maven-plugin/blob/0d76872630d847db25d16bca8936f7c36fcc2170/src/main/java/kr/motd/maven/os/Detector.java#L181 .

trustin commented 3 years ago

Thanks a lot for reporting this issue, @advancedwebdeveloper! What do you think about sending a pull request if you already have a patch?

advancedwebdeveloper commented 3 years ago

Well, I can tell that it allowed to build it. I tired to run https://github.com/trustin/os-maven-plugin/blob/master/test - and it allowed to identify Debian 10, RISC-V arch. properly. But there where some aside issues - that is not related to the functionality of your artifact.

I can try to make a pull request

advancedwebdeveloper commented 3 years ago

Ping

trustin commented 3 years ago

Fixed via #52 and #53.

xswfantasy commented 2 years ago

hi, I have a similar problem:

Here is what I am using:

java -version && javac -version

openjdk version "17.0.3" 2022-04-19 OpenJDK Runtime Environment (build 17.0.3+7-Ubuntu-0ubuntu0.22.04.1) OpenJDK 64-Bit Zero VM (build 17.0.3+7-Ubuntu-0ubuntu0.22.04.1, interpreted mode) javac 17.0.3

The error is as follows:

root@df8743386e44:/zeebe-1.3.5# mvn dependency:get -B \ -DremoteRepositories="camunda-nexus::::https://app.camunda.com/nexus/content/repositories/public" \ -DgroupId="io.camunda" -DartifactId="camunda-cloud-zeebe" \ -Dos.detected.name=linux -Dos.detected.arch=riscv -Dos.detected.classifier=linux-riscv \ -Dversion="1.3.5" -Dpackaging="tar.gz" -Dtransitive=false

[INFO] Scanning for projects... [INFO] Inspecting build with total of 40 modules... [INFO] Not installing Nexus Staging features: [INFO] * Preexisting staging related goal bindings found in 40 modules. [INFO] ------------------------------------------------------------------------ [INFO] Detecting the operating system and CPU architecture [INFO] ------------------------------------------------------------------------ [INFO] os.detected.name: linux [INFO] os.detected.arch: unknown [INFO] os.detected.bitness: 64 [INFO] os.detected.version: 5.15 [INFO] os.detected.version.major: 5 [INFO] os.detected.version.minor: 15 [ERROR] unknown os.arch: riscv64 -> [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/MavenExecutionException