gpt4 book ai didi

java - SonarQube Ant 任务,下载文件失败

转载 作者:太空宇宙 更新时间:2023-11-04 13:00:23 26 4
gpt4 key购买 nike

我正在为 SonarQube 运行一个简单的 Ant 脚本,但出现以下错误:

FileNotFoundException: C:\Users\c5187668\sap\simpleAnt.sonar\batch\sonar-batch-maven-compat-5.1.2.jar|99845a2f47eaef85b29978725f82c50c"

  • SonarQube 服务器版本 5.1.2
  • Apache Ant(TM) 版本 1.9.6 编译于 2015 年 6 月 29 日
  • Sonar Ant 任务版本:2.0
  • Java 1.6 - 因此,我们无法使用现代版本的 Sonar Ant。

能以某种方式修复吗?有什么想法吗?

Ant 脚本:

<project name="sonar build" default="Sonar" basedir="." xmlns:sonar="antlib:org.sonar.ant">

<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="sonar-ant-task.jar"/>
</taskdef>
<!-- Out-of-the-box those parameters are optional -->
<property name="sonar.jdbc.url" value="dbc:mysql://?????:3306/sonardb?useUnicode=true;characterEncoding=utf8" />
<property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" />
<property name="sonar.jdbc.username" value="?????" />
<property name="sonar.jdbc.password" value="?????" />
<!-- Additional Sonar configuration (PMD need 1.5 when using annotations)-->
<property name="sonar.java.source" value="1.6"/>
<property name="sonar.java.target" value="1.6"/>
<property name="sonar.projectName" value="SonarBuild"/>
<property name="sonar.projectVersion" value="2.0" />
<!-- SERVER ON A REMOTE HOST -->
<property name="sonar.host.url" value="http://??????" />
<target name="Sonar">
<sonar:sonar />
</target>

我收到以下错误:

BUILD FAILED C:\Users\c5187668\sap\simpleAnt\build.xml:17:
java.lang.IllegalStateException: Fail to download libraries from
server
at org.sonar.runner.Bootstrapper.downloadBatchFiles(Bootstrapper.java:166)
at org.sonar.runner.Bootstrapper.createClassLoader(Bootstrapper.java:89)
at org.sonar.runner.Runner.createClassLoader(Runner.java:229)
at org.sonar.runner.Runner.execute(Runner.java:151)
at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:93)
at org.sonar.ant.SonarTask.execute(SonarTask.java:75)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112) Caused
by: java.lang.IllegalStateException: Fail to download the file:
http://???????/batch/sonar-batch-maven-compat-5.1.2.jar|99845a2f47eaef85b29
978725f82c50c

at org.sonar.runner.Bootstrapper.remoteContentToFile(Bootstrapper.java:115)
at org.sonar.runner.Bootstrapper.downloadBatchFiles(Bootstrapper.java:161)
... 22 more Caused by: java.io.FileNotFoundException: C:\Users\c5187668\sap\simpleAnt\.sonar\batch\sonar-batch-maven-compat-5.1.2.jar|99845a2f47eaef85b29978725f82c50c
(The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at org.sonar.runner.Bootstrapper.remoteContentToFile(Bootstrapper.java:109)
... 23 more

Total time: 0 seconds

附注通过问号????我隐藏真实的服务器名称和凭据。

最佳答案

您的 Ant Task 版本 (2.0) 与您的 SonarQube 版本不兼容。这个compatibility matrix显示 v2.2 是自 SonarQube 3.7 以来的最低要求(2.4 是 SonarQube 4.5+ 的最佳选择)。

您应该升级您的 SonarQube Scanner for Ant并且还使用 supported version of Java .

关于java - SonarQube Ant 任务,下载文件失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34993040/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com