GithubHelp home page GithubHelp logo

Comments (5)

rohdef avatar rohdef commented on July 2, 2024 1

It outputs:

[info] ans: scala.collection.immutable.Map[String,String] = Map(SHELL -> /bin/bash, LOGNAME -> rohdef, SHELL_SESSION_ID -> 0395898dc07f4639832d70bc90ddae17, PATH -> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin, XDG_CONFIG_DIRS -> /etc/xdg/xdg-plasma:/etc/xdg:/usr/share/kubuntu-default-settings/kf5-settings, TERM -> xterm-256color, KDE_SESSION_VERSION -> 5, XDG_SESSION_CLASS -> user, LESSCLOSE -> /usr/bin/lesspipe %s %s, WINDOWID -> 69206023, XDG_SESSION_PATH -> /org/freedesktop/DisplayManager/Session0, XDG_SEAT_PATH -> /org/freedesktop/DisplayManager/Seat0, LC_MEASUREMENT -> da_DK.UTF-8, XDG_SESSION_TYPE -> x11, LESSOPEN -> | /usr/bin/lesspipe %s, XDG_SEAT -> seat0, LC_NUMERIC -> da_DK.UTF-8, LS_COLORS -> rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:, SESSION_MANAGER -> local/josefine:@/tmp/.ICE-unix/1447,unix/josefine:/tmp/.ICE-unix/1447, XCURSOR_SIZE -> 36, XDG_SESSION_ID -> 1, LC_TIME -> da_DK.UTF-8, PROFILEHOME -> , KONSOLE_PROFILE_NAME -> Pastel, HOME -> /home/rohdef, COLORTERM -> truecolor, XDG_SESSION_DESKTOP -> KDE, XDG_DATA_DIRS -> /usr/share/plasma:/usr/local/share:/usr/share:/var/lib/snapd/desktop, SSH_AGENT_PID -> 1126, QT_SCREEN_SCALE_FACTORS -> DVI-I-0=1.5;DVI-I-1=1.5;HDMI-0=1.5;DP-0=1.5;DVI-D-0=1.5;DP-1=1.5;, QT_ACCESSIBILITY -> 1, USER -> rohdef, KDE_FULL_SESSION -> true, KONSOLE_DBUS_SESSION -> /Sessions/2, QT_AUTO_SCREEN_SCALE_FACTOR -> 0, LC_MONETARY -> da_DK.UTF-8, LANGUAGE -> en_US:en, XAUTHORITY -> /home/rohdef/.Xauthority, KONSOLE_DBUS_WINDOW -> /Windows/1, XCURSOR_THEME -> Breeze_Snow, SHLVL -> 3, GS_LIB -> /home/rohdef/.fonts, _ -> /usr/bin/java, PWD -> /home/rohdef/IdeaProjects/ticket-server, GPG_AGENT_INFO -> /run/user/1000/gnupg/S.gpg-agent:0:1, XDG_VTNR -> 1, DISPLAY -> :0, LANG -> en_US.UTF-8, XDG_RUNTIME_DIR -> /run/user/1000, DBUS_SESSION_BUS_ADDRESS -> unix:path=/run/user/1000/bus, XDG_CURRENT_DESKTOP -> KDE, KDE_SESSION_UID -> 1000, COLORFGBG -> 15;0, KONSOLE_DBUS_SERVICE -> :1.82, SSH_AUTH_SOCK -> /tmp/ssh-bTODX7fYdu2M/agent.1055, DESKTOP_SESSION -> plasma)

And indeed (sparing the search) it's not there. But if it's a matter of next version, then let's not spend time on it, as long as I'm the only one having this issue - after all I got a workaround ;)

from sbt-sonar.

rohdef avatar rohdef commented on July 2, 2024

Oh yeah, forgot, also please add how to properly set SONAR_SCANNER_HOME and sonarScanner.home. Never got SONAR_SCANNER_HOME to work (is it a bash environment variable? If so, it doesn't seem to work for me). So far only way I got that part to work is:

sbt -DsonarScanner.home=/home/rohdef/Programs/sonar-scanner-3.2.0.1227-linux sonarScan

Is that really the right way?

from sbt-sonar.

mwz avatar mwz commented on July 2, 2024

Hi @rohdef and thanks for your feedback.

My initial project/build.properties had sbt.version set to 1.2.1 which doesn't seem to work (is that due to: crossSbtVersions := Seq("0.13.17", "1.1.6")?). At least it seems to work with both 0.13.17 and 1.1.6. If a correct version is a requirement that would be nice to know.

That's interesting - I've used this plugin with 1.2.1 without any issues - it would be good to see what error you're getting - feel free to create a new issue about this and I'll be happy to take a look.

As I ran in to your plugin fairly early in my Scala learning process (well tools like these are good for learning good practices) I'm far from experienced in sbt, I was confused about where to put the sonarProperties ++= Map(..., seems that build.sbt is the right place, although googling also showed that I can do something like build.sonar.sbt :) That would probably be a very helpful addition to other newcomers.

You should definitely check out sbt documentation, but yes, those settings should be added to your build.sbt file along with the imports listed in the README.

Having a fully working minimal example of the use would be a very nice addition. Could be in a folder named examples, or something similar.

The examples are in the src/sbt-test directory, but I will link them somewhere in the README so it's easier to find them 👍

Never got SONAR_SCANNER_HOME to work (is it a bash environment variable?

Yes, this is an environment variable which needs to be exported in your shell before running the analysis. If you use bash you can export it in your .bashrc or .profile files:

export SONAR_SCANNER_HOME=~/Programs/sonar-scanner-3.2.0.1227-linux

Your example will also work, but it's easier to have it set as an environment variable because you only have to do it once.
Btw, this won't be necessary in the next major version as we'll use an embedded sonar scanner which doesn't require sonar-scanner-cli, but for now you have to do this.

from sbt-sonar.

rohdef avatar rohdef commented on July 2, 2024

Hi @rohdef and thanks for your feedback.

My initial project/build.properties had sbt.version set to 1.2.1 which doesn't seem to work (is that due to: crossSbtVersions := Seq("0.13.17", "1.1.6")?). At least it seems to work with both 0.13.17 and 1.1.6. If a correct version is a requirement that would be nice to know.

That's interesting - I've used this plugin with 1.2.1 without any issues - it would be good to see what error you're getting - feel free to create a new issue about this and I'll be happy to take a look.

Strange I cannot reproduce that anymore, must have been a fluke in the IntelliJ setup, I guess we can ignore that issue then :)

As I ran in to your plugin fairly early in my Scala learning process (well tools like these are good for learning good practices) I'm far from experienced in sbt, I was confused about where to put the sonarProperties ++= Map(..., seems that build.sbt is the right place, although googling also showed that I can do something like build.sonar.sbt :) That would probably be a very helpful addition to other newcomers.

You should definitely check out sbt documentation, but yes, those settings should be added to your build.sbt file along with the imports listed in the README.

Will definitely do in due time :) It feels like I'm learning a million new things right now ;)

Having a fully working minimal example of the use would be a very nice addition. Could be in a folder named examples, or something similar.

The examples are in the src/sbt-test directory, but I will link them somewhere in the README so it's easier to find them

Indeed, and I found those after a while, but for instance there's no configuration in build.sbt apart from the addSbtPlugin, which caused me to be confused about where to place the sonarProperties part :) And also it would be perfect if it is a bit like:

    sonarProperties ++= Map(
      "sonar.scala.version" -> "2.12.",
      "sonar.projectName" -> "something fancy",
      "sonar.projectKey" -> "fancy-proj",
      "sonar.sources" -> "src/main/scala",
      "sonar.host.url" -> "http://localhost:9000"
    )

I suspect that's what most would want to use (e.g., I wouldn't like the host to be specified by sonar scanner, and per your comment later it soon won't be needed any more - I look forward to that 👍 )

Never got SONAR_SCANNER_HOME to work (is it a bash environment variable?

Yes, this is an environment variable which needs to be exported in your shell before running the analysis. If you use bash you can export it in your .bashrc or .profile files:

export SONAR_SCANNER_HOME=~/Programs/sonar-scanner-3.2.0.1227-linux

Your example will also work, but it's easier to have it set as an environment variable because you only have to do it once.
Btw, this won't be necessary in the next major version as we'll use an embedded sonar scanner which doesn't require sonar-scanner-cli, but for now you have to do this.

Strange, if I run the following:

rohdef@josefine:~/IdeaProjects/ticket-server$ echo $SONAR_SCANNER_HOME 
/home/rohdef/Programs/sonar-scanner-3.2.0.1227-linux
rohdef@josefine:~/IdeaProjects/ticket-server$ sbt sonarScan
[info] Loading settings for project global-plugins from idea.sbt ...
[info] Loading global plugins from /home/rohdef/.sbt/1.0/plugins
[info] Loading settings for project ticket-server-build from plugins.sbt ...
[info] Loading project definition from /home/rohdef/IdeaProjects/ticket-server/project
[info] Loading settings for project ticket-server from build.sbt,build.sonar.sbt ...
[info] Set current project to ticket-server (in build file:/home/rohdef/IdeaProjects/ticket-server/)
[error] java.lang.RuntimeException: SONAR_SCANNER_HOME environment variable or sonarScanner.home system property not defined.
[error]         at scala.sys.package$.error(package.scala:27)
[error]         at sbtsonar.SonarPlugin$.$anonfun$projectSettings$5(SonarPlugin.scala:57)
[error]         at scala.Option.getOrElse(Option.scala:121)
[error]         at sbtsonar.SonarPlugin$.$anonfun$projectSettings$3(SonarPlugin.scala:56)
[error]         at sbtsonar.SonarPlugin$.$anonfun$projectSettings$3$adapted(SonarPlugin.scala:49)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:67)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.Execute.work(Execute.scala:278)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:834)
[error] (sonarScan) SONAR_SCANNER_HOME environment variable or sonarScanner.home system property not defined.
[error] Total time: 0 s, completed Dec 16, 2018, 4:41:25 PM
rohdef@josefine:~/IdeaProjects/scala-proj$ 

I would say it should work but, if it's irrelevant from the next version it's probably not worth the time

from sbt-sonar.

mwz avatar mwz commented on July 2, 2024

That's strange - it looks like your env variable for some reason isn't correctly picked up by sbt. To see what env variables you have available in sbt, you can run eval sys.env in sbt shell - hopefully that will help you to figure out what is going on.

from sbt-sonar.

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.