Coder Social home page Coder Social logo

java: not found about sonar-scanner-npm HOT 10 CLOSED

joelnet avatar joelnet commented on August 20, 2024
java: not found

from sonar-scanner-npm.

Comments (10)

epelaic avatar epelaic commented on August 20, 2024 3

Hello,

I have the same issue on node:12-alpine in gitlab-ci pipeline.

I run in before_script to run once who failed every time just to install it:

 before_script:
    - apk --update add openjdk8-jre
    - npm run sonar || echo 'Sonar fail'
    - sed -i 's/use_embedded_jre=true/use_embedded_jre=false/g' /root/.sonar/native-sonar-scanner/sonar-scanner-4.4.0.2170-linux/bin/sonar-scanner

script:
    - npm run sonar

It works but it's very ugly.

Can you just put an args to set by le command line the boolean value of use_embedded_jre in sonar-scanner (sh & bat) script.
To launch the cmd like this : npm run sonar -Duse_embedded_jre=false

Actually the value is hard coded :

set use_embedded_jre=true
if "%use_embedded_jre%" == "true" (
  set "JAVA_HOME=%SONAR_SCANNER_HOME%\jre"
)

if not "%JAVA_HOME%" == "" goto foundJavaHome

Thanks,
Edo

from sonar-scanner-npm.

martijnhjk avatar martijnhjk commented on August 20, 2024 1

Has there been any follow up on this? I am still having this issue on node alpine

from sonar-scanner-npm.

rafis avatar rafis commented on August 20, 2024 1

Thank you, Edo (@epelaic), I have improved your sed a little bit:

set -- /root/.sonar/native-sonar-scanner/* && sed -i 's/use_embedded_jre=true/use_embedded_jre=false/g' "$1/bin/sonar-scanner"

Warning! Do not thinkless copy-paste, I'm not any good Shell-developer.

from sonar-scanner-npm.

fabb avatar fabb commented on August 20, 2024 1

@bellingard the readme says:

sonarqube-scanner makes it very easy to trigger SonarQube / SonarCloud analyses on a JavaScript code base, without needing to install any specific tool or (Java) runtime.

It looks like this is not true, it does not work without a java runtime.

from sonar-scanner-npm.

fabb avatar fabb commented on August 20, 2024 1

The link in the comment above is dead, but i found this docker image that fixes the issue for alpine by installing glibc:

https://github.com/Docker-Hub-frolvlad/docker-alpine-glibc/blob/master/Dockerfile

from sonar-scanner-npm.

gabssnake avatar gabssnake commented on August 20, 2024 1

Hello again everyone,

Thanks for bringing this up. I created a list of potential improvements and mentioned this topic:

I'll close this issue for now. Feel free to reopen if you want to create a PR ;)

from sonar-scanner-npm.

sidharta avatar sidharta commented on August 20, 2024

Hey, have you found a fix / workaround for this one?

from sonar-scanner-npm.

joelnet avatar joelnet commented on August 20, 2024

I ended up creating a new Dockerfile with Java installed. You'll have do download the jdk from Oracle.

ENV JAVA_HOME /opt/java/current
ENV PATH $PATH:/opt/java/current/bin

COPY packages/jdk-8u212-linux-x64.tar.gz /opt/java/jdk-8u212-linux-x64.tar.gz

# Oracle Java - https://wiki.alpinelinux.org/wiki/Installing_Oracle_Java
RUN ( \
  cd /opt/java; \
  tar -zxvf jdk-8u212-linux-x64.tar.gz;\
  rm jdk-8u212-linux-x64.tar.gz; \
  chown -R root.root jdk1.8.0_212/; \
  ln -s jdk1.8.0_212 /opt/java/current; \
  printf "export JAVA_HOME=/opt/java/current\nexport PATH=$PATH:\$JAVA_HOME/bin\n" > /etc/profile.d/java.sh; \
  which paxctl || apk add paxctl; \
  cd ./current/bin; \
  paxctl -c java; \
  paxctl -m java; \
  paxctl -c javac; \
  paxctl -m javac; \
  )

It would be nice if Java wasn't needed though.

from sonar-scanner-npm.

fabb avatar fabb commented on August 20, 2024

Ah ok: #59 (comment)

from sonar-scanner-npm.

gabssnake avatar gabssnake commented on August 20, 2024

Hey @fabb, would like to contribute a small PR for the readme?

from sonar-scanner-npm.

Related Issues (20)

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.