从 SonarQube 4.5.4 LTS 升级到 5.3 后,Ant 分析无法删除文件
Posted
技术标签:
【中文标题】从 SonarQube 4.5.4 LTS 升级到 5.3 后,Ant 分析无法删除文件【英文标题】:After upgrade from SonarQube 4.5.4 LTS to 5.3, Ant analysis unable to delete files 【发布时间】:2016-09-05 14:26:49 【问题描述】:我们最近从 Sonarqube 4.5.4 LTS 升级到了 5.3。升级后,我们在通过 SonarQube Scanner for Ant 进行分析时遇到了问题。
相关日志错误信息:
...
Caused by: java.io.IOException: Unable to delete file: C:\build-dir\PUM-PUM30SONAR-JOB1\.sonar\cache\ff4174ae66dafc76b7dd3adbf9942334\sonar-pmd-plugin-2.5.jar_unzip\META-INF\lib\sslr-xpath-1.20.jar
在 SonarQube 升级之前进行的分析很好。之后的每次执行都因此错误而失败。
所以,就像构建成功创建了这个缓存目录,但是当它试图清理它时,它失败了。使用 Maven 或 sonar-runner 的任何构建均未报告任何问题。
持续集成应用:Bamboo 5.7.2 构建代理:Windows 2008 Server,发生在多个代理上 受影响的构建:仅确认一个,但可能更多 SonarQube 5.3 蚂蚁 1.9.3 适用于 Ant 2.4 的 SonarQube 扫描仪我尝试过的:
已验证 Bamboo 代理服务以正确用户身份运行,并且可以手动删除文件 手动从代理清除构建目录 强制构建在备用代理上运行build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="POS Build" default="generate-installer">
<property name="release.dir" value="release" />
<property name="logs.dir" value="logs" />
<property name="implementation.version" value="3.0.0.0.x"/>
<property name="implementation.title" value="Redacted Module" />
<property name="ia.home" value="$ia.home" />
<tstamp>
<format property="today" pattern="d-MMMM-yyyy" />
</tstamp>
<target name="clean" description="Cleans up the build directory">
<delete dir="$release.dir" failonerror="no" />
<delete dir="$logs.dir" failonerror="no" />
<delete dir="$basedir/.sonar" failonerror="no"/>
</target>
<target name="init">
<mkdir dir="$release.dir" />
<mkdir dir="$release.dir/classes" />
<mkdir dir="$release.dir/drop" />
</target>
<target name="compile" depends="init">
<javac classpath="$param_classpath" srcdir="src" destdir="$release.dir/classes" fork="true" />
<copy todir="$release.dir/classes" overwrite="true">
<fileset dir=".">
<exclude name ="resources/apache-ant-1.9.2-bin.zip" />
<include name="resources/**" />
<include name="work/**" />
</fileset>
<fileset dir ="src">
<include name ="**/*.properties" />
</fileset>
</copy>
<jar jarfile="$release.dir/drop/pum.jar" basedir="$release.dir/classes">
<manifest>
<attribute name="Created-By" value="$java.runtime.version" />
<attribute name="Built-On" value="$today" />
<attribute name="Implementation-Vendor" value="RedactedCompany Inc." />
<attribute name="Implementation-Version" value="3.0.0.0.$build_no" />
<attribute name="Implementation-Title" value="$implementation.title" />
<!-- <attribute name="SplashScreen-Image" value="resources/images/splash.png" /> -->
<attribute name="Main-Class" value="com.RedactedCompany.pos.pum.PUMApp" />
<attribute name="Class-Path" value="$manifest_classpath" />
</manifest>
</jar>
<copy todir="$release.dir/drop" overwrite="true">
<fileset dir=".">
<include name="resources/**" />
<include name="lib/**" />
<include name="work/**" />
</fileset>
</copy>
</target>
<target name="build" depends="init">
<antcall target="clean" />
<property name="project.classpath" value="
lib/commons-lang3-3.1.jar;
lib/jh.jar;
lib/jsch-0.1.50.jar;
lib/log4j-1.2.15.jar;
lib/OfficeLnFs.jar;
lib/opencsv-2.3.jar;
lib/vim25.jar;
lib/swingx-all-1.6.5-1.jar;
lib/json-simple-1.1.1.jar;
lib/balloontip-1.2.4.1.jar;
lib/commons-validator-1.4.0.jar;
lib/ini4j-0.5.2-SNAPSHOT.jar;
lib/maven-artifact-3.0.5.jar;
lib/selenium-java-2.45.0.jar;
lib/selenium-server-standalone-2.45.0.jar;
" />
<property name="manifest.classpath" value="
lib/commons-lang3-3.1.jar
lib/jh.jar
lib/jsch-0.1.50.jar
lib/log4j-1.2.15.jar
lib/OfficeLnFs.jar
lib/opencsv-2.3.jar
lib/vim25.jar
lib/swingx-all-1.6.5-1.jar
lib/json-simple-1.1.1.jar
lib/balloontip-1.2.4.1.jar
lib/commons-validator-1.4.0.jar
lib/ini4j-0.5.2-SNAPSHOT.jar
lib/maven-artifact-3.0.5.jar
lib/selenium-java-2.45.0.jar
lib/selenium-server-standalone-2.45.0.jar
" />
<antcall target="compile">
<param name="param_classpath" value="$project.classpath" />
<param name="manifest_classpath" value="$manifest.classpath" />
</antcall>
</target>
<target name="generate-installer" depends="build" description="Generates the installer" >
<echo message="Start building the installer." />
<taskdef name="buildinstaller" classname="com.zerog.ia.integration.ant.InstallAnywhereAntTask">
<classpath>
<pathelement location="$release.dir/drop/lib/iaant.jar" />
</classpath>
</taskdef>
<buildinstaller IAlocation="$ia.home" IAProjectFile="$basedir/PUM3_0.iap_xml" BuildWindowsWithoutVM="false" BuildWindowsWithVM="true" BuildLinuxWithoutVM="false" BuildLinuxWithVM="true" BuildMergeModule="false" BuildReadOnlyMergeModule="false" OptimizeMergeModule="false" OptimizeWebInstaller="true" />
<echo message="Finished building the installer." />
</target>
<target name="sonar" depends="build">
<path id="sonar.classpath">
<fileset dir="$basedir/lib" includes="**/*.jar" />
</path>
<taskdef resource="org/sonar/ant/antlib.xml" uri="antlib:org.sonar.ant" classpath="$basedir/lib/sonarqube-ant-task-2.4.jar"/>
<property name="sonar.userHome" value="$basedir/.sonar"/>
<property name="sonar.projectKey" value="com.RedactedCompany.redactedpart:pum:3.0.0" />
<property name="sonar.projectName" value="$implementation.title" />
<property name="sonar.projectVersion" value="$implementation.version" />
<property name="sonar.projectBaseDir" value="$basedir"/>
<property name="sonar.sources" value="$basedir/src"/>
<property name="sonar.java.binaries" value="$release.dir/classes" />
<property name="sonar.java.libraries" value="$basedir/lib/*.jar" />
<property name="sonar.jdbc.url" value="jdbc:postgresql://sonar.forge.RedactedCompany.com/sonar" />
<property name="sonar.jdbc.driver" value="org.postgresql.Driver" />
<property name="sonar.host.url" value="http://sonar.forge.RedactedCompany.com/" />
<sonar:sonar xmlns:sonar="antlib:org.sonar.ant">
</sonar:sonar >
</target>
</project>
清洗过的竹原木:
simple 03-May-2016 02:43:17 Build PUM - PUM - PUM - PUMSONAR 3.0 - Sonar report #129 (PUM-PUM30SONAR-JOB1-129) started building on agent WIN-UFUHGNWD3QG
simple 03-May-2016 02:43:17 Build working directory is C:\build-dir\PUM-PUM30SONAR-JOB1
simple 03-May-2016 02:43:17 Executing build PUM - PUM - PUM - PUMSONAR 3.0 - Sonar report #129 (PUM-PUM30SONAR-JOB1-129)
simple 03-May-2016 02:43:17 Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'
simple 03-May-2016 02:43:17 Running preRetrieveSourceCode task...
simple 03-May-2016 02:43:17 Updating source code to revision: 1011
simple 03-May-2016 02:43:17 Existing workspace found at 'C:\build-dir\PUM-PUM30SONAR-JOB1'. updating...
simple 03-May-2016 02:43:19 Updated source code to revision: 1011
simple 03-May-2016 02:43:19 Running postRetrieveSourceCode task...
simple 03-May-2016 02:43:19 Finished task 'Checkout Default Repository' with result: Success
simple 03-May-2016 02:43:19 Running pre-build action: VCS Version Collector
simple 03-May-2016 02:43:19 Running pre-build action: Clover Grails PreBuild Action
simple 03-May-2016 02:43:19 Starting task 'ANT Build' of type 'com.atlassian.bamboo.plugins.ant:task.builder.ant'
command 03-May-2016 02:43:19 Beginning to execute external process for build 'PUM - PUM - PUM - PUMSONAR 3.0 - Sonar report #129 (PUM-PUM30SONAR-JOB1-129)'\n ... running command line: TRUNCATED - AVAILABLE ON REQUEST
build 03-May-2016 02:43:19 Buildfile: C:\build-dir\PUM-PUM30SONAR-JOB1\build.xml
build 03-May-2016 02:43:20
build 03-May-2016 02:43:20 init:
build 03-May-2016 02:43:20
build 03-May-2016 02:43:20 build:
build 03-May-2016 02:43:20
build 03-May-2016 02:43:20 clean:
build 03-May-2016 02:43:20 [delete] Deleting directory C:\build-dir\PUM-PUM30SONAR-JOB1\release
build 03-May-2016 02:43:20 [delete] Deleting directory C:\build-dir\PUM-PUM30SONAR-JOB1\.sonar
build 03-May-2016 02:43:20
build 03-May-2016 02:43:20 init:
build 03-May-2016 02:43:20 [mkdir] Created dir: C:\build-dir\PUM-PUM30SONAR-JOB1\release
build 03-May-2016 02:43:20 [mkdir] Created dir: C:\build-dir\PUM-PUM30SONAR-JOB1\release\classes
build 03-May-2016 02:43:20 [mkdir] Created dir: C:\build-dir\PUM-PUM30SONAR-JOB1\release\drop
build 03-May-2016 02:43:20
build 03-May-2016 02:43:20 compile:
build 03-May-2016 02:43:20 [javac] C:\build-dir\PUM-PUM30SONAR-JOB1\build.xml:57: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
build 03-May-2016 02:43:21 [javac] Compiling 260 source files to C:\build-dir\PUM-PUM30SONAR-JOB1\release\classes
build 03-May-2016 02:43:27 [javac] Note: Some input files use or override a deprecated API.
build 03-May-2016 02:43:27 [javac] Note: Recompile with -Xlint:deprecation for details.
build 03-May-2016 02:43:27 [javac] Note: Some input files use unchecked or unsafe operations.
build 03-May-2016 02:43:27 [javac] Note: Recompile with -Xlint:unchecked for details.
build 03-May-2016 02:43:27 [copy] Copying 59 files to C:\build-dir\PUM-PUM30SONAR-JOB1\release\classes
build 03-May-2016 02:43:28 [jar] Building jar: C:\build-dir\PUM-PUM30SONAR-JOB1\release\drop\pum.jar
build 03-May-2016 02:43:29 [copy] Copying 72 files to C:\build-dir\PUM-PUM30SONAR-JOB1\release\drop
build 03-May-2016 02:43:29
build 03-May-2016 02:43:29 sonar:
build 03-May-2016 02:43:29 [sonar:sonar] Apache Ant(TM) version 1.9.3 compiled on December 23 2013
build 03-May-2016 02:43:29 [sonar:sonar] SonarQube Ant Task version: 2.4
build 03-May-2016 02:43:29 [sonar:sonar] Loaded from: file:/C:/build-dir/PUM-PUM30SONAR-JOB1/lib/sonarqube-ant-task-2.4.jar
build 03-May-2016 02:43:30 [sonar:sonar] User cache: C:\build-dir\PUM-PUM30SONAR-JOB1\.sonar\cache
build 03-May-2016 02:43:34 [sonar:sonar] Load global repositories
build 03-May-2016 02:43:35 [sonar:sonar] Load global repositories (done) | time=421ms
build 03-May-2016 02:43:35 [sonar:sonar] Property 'sonar.jdbc.url' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
build 03-May-2016 02:43:35 [sonar:sonar] Property 'sonar.jdbc.username' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
build 03-May-2016 02:43:35 [sonar:sonar] Property 'sonar.jdbc.password' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
build 03-May-2016 02:43:35 [sonar:sonar] User cache: C:\build-dir\PUM-PUM30SONAR-JOB1\.sonar\cache
build 03-May-2016 02:43:35 [sonar:sonar] Load plugins index
build 03-May-2016 02:43:35 [sonar:sonar] Load plugins index (done) | time=5ms
build 03-May-2016 02:43:35 [sonar:sonar] Download sonar-cobertura-plugin-1.6.3.jar
build 03-May-2016 02:43:35 [sonar:sonar] Download sonar-cxx-plugin-0.9.5.jar
build 03-May-2016 02:43:36 [sonar:sonar] Download sonar-crowd-plugin-2.0.jar
build 03-May-2016 02:43:36 [sonar:sonar] Download sonar-pmd-plugin-2.5.jar
build 03-May-2016 02:43:37 [sonar:sonar] Download sonar-stylecop-plugin-1.1.jar
build 03-May-2016 02:43:37 [sonar:sonar] Download sonar-motion-chart-plugin-1.7.jar
build 03-May-2016 02:43:37 [sonar:sonar] Download sonar-scm-svn-plugin-1.3.jar
build 03-May-2016 02:43:37 [sonar:sonar] Download sonar-javascript-plugin-2.11.jar
build 03-May-2016 02:43:37 [sonar:sonar] Download sonar-csharp-plugin-5.1.jar
build 03-May-2016 02:43:38 [sonar:sonar] Download sonar-findbugs-plugin-3.3.jar
build 03-May-2016 02:43:38 [sonar:sonar] Download sonar-java-plugin-3.13.jar
build 03-May-2016 02:43:38 [sonar:sonar] Download sonar-scm-git-plugin-1.2.jar
build 03-May-2016 02:43:39 [sonar:sonar] Download sonar-xml-plugin-1.4.1.jar
build 03-May-2016 02:43:39 [sonar:sonar] Download sonar-php-plugin-2.8.jar
build 03-May-2016 02:43:39 [sonar:sonar] Download sonar-timeline-plugin-1.5.jar
build 03-May-2016 02:43:39 [sonar:sonar] Download sonar-build-breaker-plugin-2.0.jar
build 03-May-2016 02:43:39 [sonar:sonar] Download sonar-checkstyle-plugin-2.4.jar
build 03-May-2016 02:43:40 [sonar:sonar] Download sonar-jira-plugin-1.2.jar
build 03-May-2016 02:43:42 [sonar:sonar] Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
build 03-May-2016 02:43:42 [sonar:sonar] Process project properties
error 03-May-2016 02:43:43
error 03-May-2016 02:43:43 BUILD FAILED
error 03-May-2016 02:43:43 C:\build-dir\PUM-PUM30SONAR-JOB1\build.xml:188: java.lang.IllegalStateException: Unable to load component class org.sonar.batch.scan.ProjectLock
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:62)
error 03-May-2016 02:43:43 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:262)
error 03-May-2016 02:43:43 at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:109)
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:130)
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
error 03-May-2016 02:43:43 at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
error 03-May-2016 02:43:43 at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
error 03-May-2016 02:43:43 at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
error 03-May-2016 02:43:43 at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
error 03-May-2016 02:43:43 at org.sonar.runner.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:67)
error 03-May-2016 02:43:43 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
error 03-May-2016 02:43:43 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
error 03-May-2016 02:43:43 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error 03-May-2016 02:43:43 at java.lang.reflect.Method.invoke(Method.java:606)
error 03-May-2016 02:43:43 at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
error 03-May-2016 02:43:43 at com.sun.proxy.$Proxy0.execute(Unknown Source)
error 03-May-2016 02:43:43 at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:274)
error 03-May-2016 02:43:43 at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:165)
error 03-May-2016 02:43:43 at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:152)
error 03-May-2016 02:43:43 at org.sonarsource.scanner.ant.SonarQubeTask.launchAnalysis(SonarQubeTask.java:72)
error 03-May-2016 02:43:43 at org.sonarsource.scanner.ant.SonarQubeTask.execute(SonarQubeTask.java:55)
error 03-May-2016 02:43:43 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
error 03-May-2016 02:43:43 at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
error 03-May-2016 02:43:43 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error 03-May-2016 02:43:43 at java.lang.reflect.Method.invoke(Method.java:606)
error 03-May-2016 02:43:43 at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
error 03-May-2016 02:43:43 at org.apache.tools.ant.Task.perform(Task.java:348)
error 03-May-2016 02:43:43 at org.apache.tools.ant.Target.execute(Target.java:435)
error 03-May-2016 02:43:43 at org.apache.tools.ant.Target.performTasks(Target.java:456)
error 03-May-2016 02:43:43 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
error 03-May-2016 02:43:43 at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
error 03-May-2016 02:43:43 at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
error 03-May-2016 02:43:43 at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
error 03-May-2016 02:43:43 at org.apache.tools.ant.Main.runBuild(Main.java:851)
error 03-May-2016 02:43:43 at org.apache.tools.ant.Main.startAnt(Main.java:235)
error 03-May-2016 02:43:43 at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
error 03-May-2016 02:43:43 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
error 03-May-2016 02:43:43 Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.api.batch.bootstrap.ProjectReactor
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:62)
error 03-May-2016 02:43:43 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
error 03-May-2016 02:43:43 at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
error 03-May-2016 02:43:43 at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
error 03-May-2016 02:43:43 at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
error 03-May-2016 02:43:43 at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
error 03-May-2016 02:43:43 at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
error 03-May-2016 02:43:43 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:60)
error 03-May-2016 02:43:43 ... 39 more
error 03-May-2016 02:43:43 Caused by: java.lang.IllegalStateException: Failed to recreate working directory: C:\build-dir\PUM-PUM30SONAR-JOB1\.sonar
error 03-May-2016 02:43:43 at org.sonar.batch.scan.MutableProjectReactorProvider.cleanDirectory(MutableProjectReactorProvider.java:46)
error 03-May-2016 02:43:43 at org.sonar.batch.scan.MutableProjectReactorProvider.provide(MutableProjectReactorProvider.java:36)
error 03-May-2016 02:43:43 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
error 03-May-2016 02:43:43 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
error 03-May-2016 02:43:43 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error 03-May-2016 02:43:43 at java.lang.reflect.Method.invoke(Method.java:606)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
error 03-May-2016 02:43:43 at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
error 03-May-2016 02:43:43 at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
error 03-May-2016 02:43:43 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
error 03-May-2016 02:43:43 at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:60)
error 03-May-2016 02:43:43 ... 53 more
error 03-May-2016 02:43:43 Caused by: java.io.IOException: Unable to delete file: C:\build-dir\PUM-PUM30SONAR-JOB1\.sonar\cache\ff4174ae66dafc76b7dd3adbf9942334\sonar-pmd-plugin-2.5.jar_unzip\META-INF\lib\sslr-xpath-1.20.jar
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2279)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2270)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2270)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2270)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2270)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2270)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
error 03-May-2016 02:43:43 at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1535)
error 03-May-2016 02:43:43 at org.sonar.batch.scan.MutableProjectReactorProvider.cleanDirectory(MutableProjectReactorProvider.java:43)
error 03-May-2016 02:43:43 ... 69 more
error 03-May-2016 02:43:43
error 03-May-2016 02:43:43 Total time: 23 seconds
simple 03-May-2016 02:43:43 Failing task since return code of [C:\ant\apache-ant-1.9.3\bin\ant.bat -Djava.io.tmpdir=c:\Users\forgeadmin\AppData\Local\Temp\PUM-PUM30SONAR-JOB1 -f build.xml sonar] was 1 while expected 0
simple 03-May-2016 02:43:43 Finished task 'ANT Build' with result: Failed
simple 03-May-2016 02:43:43 Running post build plugin 'Artifact Copier'
simple 03-May-2016 02:43:43 Publishing an artifact: Drop
simple 03-May-2016 02:43:43 Finished publishing of artifact Job artifact: [Drop], pattern: [release/drop/Default_Configuration/Web_Installers/InstData/] in 0s
simple 03-May-2016 02:43:43 Running post build plugin 'npm Cache Cleanup'
simple 03-May-2016 02:43:43 Running post build plugin 'NCover Results Collector'
simple 03-May-2016 02:43:43 Running post build plugin 'Clover Results Collector'
simple 03-May-2016 02:43:43 Finalising the build...
simple 03-May-2016 02:43:43 Stopping timer.
simple 03-May-2016 02:43:43 Build PUM-PUM30SONAR-JOB1-129 completed.
simple 03-May-2016 02:43:58 Running on server: post build plugin 'Clover Delta Calculator'
simple 03-May-2016 02:43:58 Running on server: post build plugin 'Build Hanging Detection Configuration'
simple 03-May-2016 02:43:58 Running on server: post build plugin 'NCover Results Collector'
simple 03-May-2016 02:43:58 Running on server: post build plugin 'Sonar Build Password Processor'
simple 03-May-2016 02:43:58 Running on server: post build plugin 'Maven Dependencies Postprocessor'
simple 03-May-2016 02:43:58 All post build plugins have finished
simple 03-May-2016 02:43:58 Generating build results summary...
simple 03-May-2016 02:43:58 Saving build results to disk...
simple 03-May-2016 02:43:58 Indexing build results...
simple 03-May-2016 02:43:58 Finished building PUM-PUM30SONAR-JOB1-129.
【问题讨论】:
好的,我认为这实际上是 Bamboo 代理的文件权限问题。当以代理进程运行的同一用户身份登录代理时,我收到“服务器目标文件夹访问被拒绝。您需要确认此操作”。消息,我可以单击“继续”并成功删除文件。我怀疑这会干扰构建过程中的删除。不知道为什么这种行为与声纳升级一致。我将尝试一些具有权限/所有权的事情。 我让用户将他的构建重新指向我们旧的 4.5.4 SonarQube 测试实例。它工作得很好。然后他将其指向 SonarQube 5.3,构建失败并出现同样的错误。在 Bamboo 构建代理上,我删除了整个 c:\build-dir 树,并使用运行 Bamboo 代理服务器的 ID 重新创建它。同样的错误。我检查了错误中注明的文件上的“有效权限”,Bamboo代理用户具有完全权限。但是,当尝试手动删除文件时,我仍然收到“Destination Folder Access Denied”消息,我需要单击该消息。 我在构建代理上禁用了 UAC。 Bamboo 用户现在可以在不同意提升管理员访问权限的情况下删除文件。仍然从构建中收到错误。 【参考方案1】:用户包含以下不推荐使用的参数,如上面的 build.xml 所示:
<property name="sonar.userHome" value="$basedir/.sonar"/>
删除此参数允许在 SonarQube 5.3 下进行构建。
【讨论】:
以上是关于从 SonarQube 4.5.4 LTS 升级到 5.3 后,Ant 分析无法删除文件的主要内容,如果未能解决你的问题,请参考以下文章
SonarQube 从 6.4 升级到 6.5 会破坏扫描仪
从 SonarQube 6.5 升级到 6.6 后出现 elasticsearch“无法以 root 身份运行”错误。没有其他改变