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.0
sonar.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隐藏的反应是不同的,详细资料请查阅网络其它资源。
手机扫一扫,欢迎关注公众号
关注程序员成长,关注软件开发