CI工具Jenkins的安裝配置【linux】——jenkins集成sonarqube-異常解决

Setup

官網https://jenkins.io/ 下載war包,扔到tomcat下启動即可。

 

如果有port限制,在iptables中打開商品限制。

 

訪問http://ip:port/jenkins,能打開Jenkins界面即为成功。

Config

選擇maven項目建立 JOB

 

每個子項目建立一個job,相互間有先後依賴次序,定期構建,異常時才發送郵件。

 

插件deploy 

 

根目錄位置/root/.jenkins,構建完成的jar/war等都在workspace下面。

 

gradle插件安裝,編譯android

 

maven插件安裝,編譯打包。

 

Android-sdk安裝,構建android項目時使用。

 

sonarqube插件安裝–》集成sonarqube形成質量報告。

 

Sonar scanner插件安裝  –》》》集成sonarqube形成質量報告。

Exception

異常1

ERROR: Failed to parse
POMsorg.apache.maven.project.ProjectBuildingException: Some problems
were encountered while processing the POMs:

[FATAL] Non-resolvable parent POM: Could not find artifact
com.vca.parent:vca:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points
at wrong local POM @ line 4, column 10

 

at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)

at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361)

at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331)

at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1291)

at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1088)

at hudson.FilePath.act(FilePath.java:990)

at hudson.FilePath.act(FilePath.java:968)

at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:950)

at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:677)

at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)

at hudson.model.Run.execute(Run.java:1738)

at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)

at hudson.model.ResourceController.execute(ResourceController.java:98)

at hudson.model.Executor.run(Executor.java:410)

Finished: FAILURE

 

無法解析父級的POM文件,應該是是POM文件中使用了繼承。

<parent>

        <groupId>com.iflytek.ossp</groupId>

        <artifactId>ossp-resserver-all</artifactId>

        <version>1.0.0-SNAPSHOT</version></parent>

可以嘗試加入<relativePath>

<parent>
        <groupId>com.iflytek.ossp</groupId>
        <artifactId>ossp-resserver-all</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
</parent>

 

異常2

[ERROR] Failed to execute goal on project vca-service: Could not
resolve dependencies for project
com.vca.service:vca-service:jar:0.0.1-SNAPSHOT: The following artifacts
could not be resolved: com.vca.common:vca-common:jar:0.0.1-SNAPSHOT,
com.vca.bean:vca-beans:jar:0.0.1-SNAPSHOT,
com.vca.dal:vca-dal:jar:0.0.1-SNAPSHOT: Could not find artifact
com.vca.common:vca-common:jar:0.0.1-SNAPSHOT -> [Help 1][ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the
-e switch.[ERROR] Re-run Maven using the -X switch to enable full debug
logging.[ERROR] [ERROR] For more information about the errors and
possible solutions, please read the following articles:[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException[JENKINS]
Archiving /root/.jenkins/workspace/vca-service/pom.xml to
com.vca.service/vca-service/0.0.1-SNAPSHOT/vca-service-0.0.1-SNAPSHOT.pom

channel stopped

Warning: you have no plugins providing access control for builds, so
falling back to legacy behavior of permitting any downstream builds to
be triggered

Triggering a new build of vca-rest

Finished: FAILURE

 

原因大致與之上的導致的相似,但配置顯然有問題。若是如下的項目結構:

Parent

Module1

Module2

Module3

 

<parent>

        <groupId>com.iflytek.ossp</groupId>

        <artifactId>ossp-resserver-all</artifactId>

        <version>1.0.0-SNAPSHOT</version>

#–必須是存在的值,如果是../vca-parent/pom.xml,很顯然是錯誤的

        <relativePath>../pom.xml</relativePath>

</parent>

 

異常3

ERROR: Error during SonarQube Scanner execution

java.lang.IllegalStateException: Error when executing blame for file src/main/java/com/vca/mq/rabbitmq/ApplicationMain.java

at org.******.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:100)

at org.******.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:59)

at org.******.batch.scm.ScmSensor.execute(ScmSensor.java:85)

at org.******.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)

at org.******.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)

at org.******.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)

at org.******.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)

at org.******.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)

at org.******.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)

at org.******.core.platform.ComponentContainer.execute(ComponentContainer.java:85)

at org.******.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:258)

at org.******.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:253)

at org.******.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)

at org.******.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)

at org.******.core.platform.ComponentContainer.execute(ComponentContainer.java:85)

at org.******.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)

at org.******.batch.bootstrapper.Batch.executeTask(Batch.java:110)

at org.******source.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.******source.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)

at com.sun.proxy.$Proxy0.execute(Unknown Source)

at org.******source.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:240)

at org.******source.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)

at org.******source.scanner.cli.Main.runAnalysis(Main.java:110)

at org.******source.scanner.cli.Main.execute(Main.java:72)

at org.******source.scanner.cli.Main.main(Main.java:60)

Caused by:
org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001:
Authentication required for '<https://192.168.1.134:8443>
Subversion Repositories'

at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:47)

at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:41)

at
org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:203)

at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:716)

at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:398)

at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:386)

at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:720)

at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:634)

at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:109)

at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1044)

at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.hasCapability(DAVRepository.java:872)

at org.tmatesoft.svn.core.io.SVNRepository.assertServerIsMergeInfoCapable(SVNRepository.java:787)

at org.tmatesoft.svn.core.io.SVNRepository.getFileRevisions(SVNRepository.java:756)

at org.tmatesoft.svn.core.internal.wc16.SVNLogClient16.doAnnotate(SVNLogClient16.java:1389)

at org.tmatesoft.svn.core.internal.wc16.SVNLogClient16.doAnnotate(SVNLogClient16.java:291)

at org.tmatesoft.svn.core.internal.wc2.old.SvnOldAnnotate.run(SvnOldAnnotate.java:45)

at org.tmatesoft.svn.core.internal.wc2.old.SvnOldAnnotate.run(SvnOldAnnotate.java:17)

at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:21)

at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235)

at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:294)

at org.tmatesoft.svn.core.wc.SVNLogClient.doAnnotate(SVNLogClient.java:295)

at org.******.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:98)

… 28 more

ERROR: 

 

sonar.projectKey=a:msgCenter
sonar.projectName=a-msgCenter
sonar.projectVersion=1.0sonar.scm.disabled=true	 --如果此處不設置,會通過svn訪問,這時候無權限。
sonar.sources=src
sonar.sourceEncoding=UTF-8
sonar.my.property=value

 

異常4

 

Subversion
 	Subversion Workspace Version		
		
	Different versions of Subversion clients store data differently in the .svn directories. This option controls which version of Subversion client Jenkins emulates. Using an older version here allows you to manipulate workspace with your older command line Subversion clients, while using a newer version allows you to use more advanced features added to later versions of Subversion, such as svn:externals support to a file.

 

 

不同version的subversion workspace version其下對.svn隱藏的反應是不同的,詳細資料請查閱網络其它

Posted in 介绍及安装说明.