Я застрял с этой ошибкой в Дженкинсе с сонаром.
17:20:29.514 WARN: Invalid character encountered in file /opt/data/jenkins/workspace/../src/main/resources/xxx-test-cert.ts at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
17:20:29.515 DEBUG: 'src/main/resources/xxx-test-cert.ts' generated metadata with charset 'UTF-8'
17:20:29.515 WARN: Excluding 1 file(s) because of unrecognized NEW_LINE characters:
17:20:29.515 WARN: - xxx-test-cert.ts ('\u000c')
17:20:29.516 DEBUG: Checking node version
17:20:29.520 ERROR: Failed to get Node.js version.No TypeScript files will be analyzed. You can exclude TypeScript files from analysis with 'sonar.exclusions' property.
java.io.IOException: Cannot run program "node": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:347)
at org.sonar.plugin.typescript.ExternalTypescriptSensor.checkCompatibleNodeVersion(ExternalTypescriptSensor.java:158)
at org.sonar.plugin.typescript.ExternalTypescriptSensor.analyze(ExternalTypescriptSensor.java:117)
at org.sonar.plugin.typescript.ExternalTypescriptSensor.execute(ExternalTypescriptSensor.java:111)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:45)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:62)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:74)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:164)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:319)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:314)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:288)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 37 common frames omitted
Исходная конфигурация сонара:
sonar.java.binaries=target/classes
sonar.sources=src/main
sonar.tests=src/test
Я пробовал все виды, например, добавив следующие свойства:
sonar.sourceEncoding=UTF-8
sonar.inclusions=src/main/java/**
И
sonar.sourceEncoding=UTF-8
sonar.exclusions=src/main/resources/**.ts
И
sonar.sourceEncoding=UTF-8
sonar.exclusions=**/**.ts
Ни один из вышеперечисленных sonar.sourceEncoding и sonar.exclusion / включений не работает
Я виделследующий пост об установке и проверке правильности версии машинописного текста установлен на сервере jenkins. Но, поскольку служба / приложение - это макет, я пока отключу сканирование машинописи.
https://docs.sonarqube.org/latest/analysis/languages/typescript/