Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

1、安装和配置JAVAjdk环境

       oracal网站http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html,下载javajdk安装包,如:jdk-7u55-windows-x64.exe

       安装jdk-7u55-windows-x64.exe,默认下一步即可(安装路径可以自定义)。

       配置环境变量:

       右击"我的电脑"——>"属性",在弹出的"系统属性"选项面板中选择"高级"选项卡,点击"环境变量"按钮,弹出"环境变量"面板,在系统变量中进行相应的配置即可。

1)  JAVA_HOME

C:\Program Files\Java\jdk1.7.0_55

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

2)  JRE_HOME

C:\Program Files\Java\jre7

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

3)  CLASSPATH

.;C\Program Files\Java\jdk1.7.0_55\lib\dt.jar;C\Program Files\Java\jdk1.7.0_55\lib\tools.jar;%TOMCAT_HOME%\bin;

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

4)  TOMCAT_HOME

D:\apache-tomcat-7.0.54

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

5)  PATH

PATH里在最后位置添加:

C:\Program Files\Java\jdk1.7.0_55; %JAVA_HOME%\jre\bin;

6)  Cmd窗口运行java-version

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

出现java版本,则说明配置成功。

 

2、     安装jenkins

      http://jenkins-ci.org/下载jenkins安装包,如:http://mirror.xmission.com/jenkins/windows/jenkins-1.566.zip

      解压缩后,运行setup.exe,默认安装,可以自定义安装路径。

      安装后,运行services.msc,查看jenkins·服务,开启服务。

      用浏览器访问http://localhost:8080/就可以访问到jenkins的页面了。

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

3、     Maven安装及配置

       http://maven.apache.org/download.cgi下载maven,如:apache-maven-3.2.1-bin.zip

解压apache-maven-3.2.1-bin.zip,到任意路径,如:d:\apache-maven-3.2.1

添加环境变量:

1)  M2_HOME

D:\apache-maven-3.2.1

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

2)  M2

%M2_HOME%\bin

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

3)  MAVEN_OPTS

-Xms256m -Xmx512m

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

4)  PATH

path最后添加:

%M2%;%JAVA_HOME%\bin;

5)  cmd窗口运行mvn –version

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

4、     ant安装和配置

http://ant.apache.org/bindownload.cgi下载ant,如:apache-ant-1.9.4-bin.zip

解压apache-ant-1.9.4-bin.zip,到任意路径,如:d:\apache-ant-1.9.4

添加环境变量:

1)  PATH

path最后添加:

D:\apache-ant-1.9.4\bin;

2)  ANT_HOME

D:\apache-ant-1.9.4

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

3)  cmd窗口运行ant –version

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

 

 

5、     sonar安装和配置

http://www.sonarqube.org/downloads/下载sonar,如:sonar-3.7.4.zip

解压sonar-3.7.4.zip,到任意路径,如:d:\sonar-3.7.4

1)  安装mysql数据库

创建数据库和账号

mysql>CREATE DATABASE sonar CHARACTERSET utf8 COLLATE utf8_general_ci;

mysql>grant all on sonar.* to sonar@‘%‘identified by ‘sonar‘;

mysql>grant all on sonar.* tosonar@localhost identified by ‘sonar‘;

mysql>flush privileges;

2)  修改sonar配置文件

修改D:\sonar-3.7.4\conf\sonar.properties,注释掉原有的jdbc行,开启mysqljdbc连接行:

#----- Credentials

# Permissions to create tables and indexesmust be granted to JDBC user.

# The schema must be created first.

sonar.jdbc.username:                       sonar

sonar.jdbc.password:                       sonar

 

#----- Embedded database H2

# Note : it does not accept connectionsfrom remote hosts, so the

# SonarQube server and the maven pluginmust be executed on the same host.

 

# Comment the following line to deactivatethe default embedded database.

# sonar.jdbc.url:                            jdbc:h2:tcp://localhost:9092/sonar

 

# directory containing H2 database files.By default it‘s the /data directory in the SonarQube installation.

#sonar.embeddedDatabase.dataDir:

# H2 embedded database server listeningport, defaults to 9092

#sonar.embeddedDatabase.port:               9092

 

 

#----- MySQL 5.x

# Comment the embedded database anduncomment the following line to use MySQL

sonar.jdbc.url:                            jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true

3)  启动sonar

运行D:\sonar-3.7.4\bin\windows-x86-64\InstallNTService.bat,运行后sonar将被安装成windows服务,我们可以到services.msc里开启sonar服务

4)  访问

浏览器打开http://localhost:9000访问sonar

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

6、     sonar-runner安装和配置

http://www.sonarqube.org/downloads/下载sonar-runner,如:sonar-runner-dist-2.4.zip

解压sonar-runner-dist-2.4.zip,到任意路径,如:D:\sonar-runner-2.4

1)  配置sonar-runner配置文件

修改D:\sonar-runner-2.4\conf\sonar-runner.properties,更改账号信息和数据源信息

#Configure here general information aboutthe environment, such as SonarQube DB details for example

#No information about specific projectshould appear here

 

#----- Default SonarQube server

sonar.host.url=http://localhost:9000

 

#----- PostgreSQL

#sonar.jdbc.url=jdbc:postgresql://localhost/sonar

 

#----- MySQL

sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8

 

#----- Oracle

#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE

 

#----- Microsoft SQLServer

#sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor

 

#----- Global database settings

sonar.jdbc.username=sonar

sonar.jdbc.password=sonar

 

#----- Default source code encoding

sonar.sourceEncoding=UTF-8

 

#----- Security (when‘sonar.forceAuthentication‘ is set to ‘true‘)

sonar.login=admin

sonar.password=admin

2)  添加环境变量:

SONAR_RUNNER_HOME

D:\sonar-runner-2.4

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

3)  PATH

PATH变量最后添加:

D:\sonar-runner-2.4\bin;

4)  cmd窗口运行sonar-runner.bat -h

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

7、     jenkins整合

访问jenkins http://localhost:8080,注册一个账号,然后登陆jenkins,进入系统管理-系统设置:

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

1、JDK安装

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

2、ant安装

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

3、Maven安装

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

Maven项目配置:

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

4、SVN配置

根据安装的svn版本号选择。

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

5、MSBuild安装

默认没有MSBuildMicrosoft.NET Framework)安装选项,需要安装插件

进入系统管理-管理插件-可选插件,在右上角 过滤 里输入MSBuild

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

安装插件,安装后进入系统管理-系统设置,可以看到MSBuilde

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

6、Sonar runner安装

默认没有sonar安装选项,需要安装插件

进入系统管理-管理插件-可选插件,在右上角过滤 里输入sonar

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 

安装插件,安装后进入系统管理-系统设置,可以看到sonar runnersonar

sonar runner配置如下:

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

sonar配置如下:

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

 


Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册,布布扣,bubuko.com

Windows+java+jenkins+maven+ant+sonar+sonar-runner安装部署技术手册

上一篇:python之7-2类的继承与多态


下一篇:Java反射技术学习总结