Hudson, Sonar, Maven, Nexus installation wizard,安装指南

[b]Hudson, Sonar, Maven, Nexus installation wizard[/b]
[*][b]Required Software:[/b]
In order to make all software work smoothly together, we need download the correct version to avoid confliction.
[list]
[b]JDK: [/b]
[*]Version: Java SE 6 Update 30
[*]official web site: [url]http://www.oracle.com/technetwork/java/javase/overview/index.html[/url]
[*]Download Page: [url]http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u30-download-1377139.html[/url]
[*]Note: We strongly recommend you use JDK 6. Because the nexus version 1.9.2 and 1.9.2.4 cannot work well with JDK 7. Because it cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor.
[/list]
[list]
[b]Tomcat[/b]
[*]Version: apache-tomcat-7.0.23 (32bit)
[*]official web site: [url]http://tomcat.apache.org/[/url]
[*]Download Page: [url]http://tomcat.apache.org/download-70.cgi[/url]
[*]Note: N/A
[/list]
[list]
[b]Hudson[/b]
[*]Version: hudson-2.2.0.war
[*]Official web site: [url]http://hudson-ci.org/[/url]
[*]Download: [url]http://java.net/projects/hudson/downloads/download/war/hudson-2.2.0.war[/url]
[/list]
[list]
[b]Sonar[/b]
[*]Version: sonar-2.12.zip
[*]official web site: [url]http://www.sonarsource.org/[/url]
[*]Download Page: [url]http://dist.sonar.codehaus.org/sonar-2.12.zip[/url]
[*]Note: N/A
[/list]
[list]
[b]Sonar Plug-in for Huson[/b]
[*]Version: sonar 1.6.1
[*]official web site: [url]http://hudson-ci.org/[/url]
[*]Download Page: [url]http://hudson-ci.org/downloads/plugins/sonar/1.6.1/[/url]
[*]Note: N/A
[/list]
[list]
[b]Nexus[/b]
[*]Version: nexus-webapp-1.9.2.war
[*]official web site: [url]http://nexus.sonatype.org/[/url]
[*]Download Page: [url]http://nexus.sonatype.org/downloads/all[/url]
[*]Note: We strongly recommend your use war file, as it can be deployed in web server to avoid port confliction. However, you can also download stand alone type nexus-oss-webapp-1.9.2.4-bundle.zip, it will use port 8081.
[/list]
[list]
[b]Maven[/b]
[*]Version: apache-maven-2.2.1
[*]official web site: [url]http://maven.apache.org/[/url]
[*]Download Page: [url]http://maven.apache.org/download.html[/url]
[*]Note: I strongly recommend that you use maven 2 rather than maven 3; maven 3 is not yet stable enough when I write this document.
[/list]
[list]
[b]MySQL[/b]
[*]Version:
[*]official web site: [url]http://www.mysql.com/[/url]
[*]Download Page: [url]http://www.mysql.com/downloads/[/url]
[/list]
[*][b]Installation [/b]
[list]
[b]Environment Variable[/b]
A lot of software needs to setup a environment variable to do some configuration to change the action at runtime. Here are the steps to do this.
[*]1. Press “Winkey + Pause”, and then click the “Advanced system settings” link at left side.
[*]2. Click the “Environment variables” button to the bottom of the “System Properties” Dialog.
[*]3. Click “New” button to create a variable.
[*]4. Input name and value for the fields on the popup dialog. Click OK to apply changes.
[img]http://dl.iteye.com/upload/attachment/0062/2691/3e477ccc-d19b-3164-b46c-276ad6978bd6.png[/img]
[b]JDK[/b]
[*]1. Click the jdk-6u30-windows-i586.exe, and follow the wizard to setup jdk.
[*]2. Press “Winkey + Pause”, and then click the “Advanced system settings” link at left side.
[*]3. Click the “Environment variables” button to the bottom of the “System Properties” Dialog.
[*]4. Click “New” button to create “JAVA_HOME”, add value “C:\Program Files (x86)\Java\jdk1.6.0_30” for it.
[*]5. Find the variable “path”, and add “%JAVA_HOME%\bin;” before it.
[*]6. Press OK to apply the changes.
[/list]
[list]
[b]Tomcat[/b]
[*]1. Unpack the binary distribution into a convenient location so that the distribution resides in its own directory (conventionally named " apache-tomcat-7.0.23"). e.g. C:\apache-tomcat-7.0.23
[*]2. Click the “C:\apache-tomcat-7.0.23\bin\startup.bat” to start the server. You can visit the link http://localhost:8080 if nothing is wrong.
[/list]
[list]
[b]Maven[/b]
[*]1. Unzip the distribution archive, i.e. apache-maven-2.2.1-bin.zip to the directory you wish to install Maven 3.0.3. These instructions assume you chose C:\. The subdirectory apache-maven-2.2.1 will be created from the archive.
[*]2. Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M2_HOME variable in the user variables with the value C:\ apache-maven-2.2.1. Be sure to omit any quotation marks around the path even if it contains spaces. Note: For Maven < 2.0.9, also be sure that the M2_HOME doesn't have a '\' as last character.
[*]3. In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin.
[*]4. Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.
[*]5. In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M2% to add Maven available in the command line.
[*]6. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.5.0_02 and that %JAVA_HOME%\bin is in your Path environment variable.
[*]7. Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.
[/list]
[list]
[b]Hudson[/b]
[*]Hudson only needs a Java 5 or newer runtime.
[b]Stand alone model[/b]:
[*]1. You can simply run the command line: Java -jar hudson.war
[*]2. To see Hudson, simply bring up a web browser and go to URL http://myServer:8080 where myServer is the name of the system running Hudson.
[b]Deploy Hudson in web container[/b]
[*]Sometimes, installing the Hudson in web container is a better choice. Hudson also uses the 8080 port. It will cause confliction if you also use tomcat and Hudson seperatelly.
[*]1. Copy hudson.war to C:\apache-tomcat-7.0.23\webapps, and startup the tomcat server by clicking C:\apache-tomcat-7.0.23\bin\startup.bat.
[*]2. To see Hudson, simply bring up a web browser and go to URL http://myServer:8080/hudson, where myServer is the name of the system running Hudson.
[*]Note: We’d better add this environment variable for tomcat. CATALINA_OPTS=-Xmx1024m -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -XX:MaxPermSize=256m
[/list]
[b]Sonar Plug-in for Huson[/b]
Copy the sonar.hpi into %HUDSON_HOME%\plugins. And restart the Tomcat server. Then the sonar plug-in will take effective in Hudson.
[b]Sonar[/b]
[*]1. Create database
Save the following script as create_database.sql, and execute it on mysql command line tool.

#
# Create Sonar database and user.
#
# Command: mysql -u root -p < create_database.sql
#
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES;

[*]2. unzip the distribution to C:\
[*]3. If you do not use the default embedded database, edit conf/sonar.properties to configure the database access. Templates are available for every supported database. Just uncomment the lines you want.

sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
sonar.jdbc.driverClassName: com.mysql.jdbc.Driver
sonar.jdbc.validationQuery: select 1
sonar.jdbc.username: sonar
sonar.jdbc.password: sonar

[*]4. You can run sonar in standalone model by click C:/sonar-2.12/bin/windows-x86-32/ StartSonar.bat, and it will take port 80, you can use it by this link http://localhost:80/sonar. But we strongly recommend that you deploy it in web container. Let’s see the next step.
[*]5. Add environment variable CATALINA_OPTS with value
[*]-Xmx1024m -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -XX:MaxPermSize=256m
[*]6. Click C:\sonar-2.12\war\build-war.bat to create a war file. And then copy the sonar.war to C:\apache-tomcat-7.0.23\webapps
[*]Note: do NOT remove C:\sonar-2.12 after you deployed war file. The original folder is still useful.
[*]Prior to Sonar 2.2, the WAR file must be rebuilt each time the configuration is updated (new plugins or new extensions).
[*]From Sonar 2.2 onwards, the WAR file is now linked to the Sonar directory (the directory where the distribution is unzipped). It implies that :
•the directory where the distribution is unzipped cannot be removed
•there is no need to rebuild the WAR when installing/uninstalling plugins or rule extensions
•the WAR file must be deployed on the host which contains the Sonar directory
•the WAR file must be rebuilt when the Sonar directory is moved
•the WAR file must be rebuilt when a configuration file is updated (directory conf/)
[*]7. Restart the tomcat server. Access sonar by http://localhost:8080/sonar .
[list]
[b]Nexus[/b]
[*]1. Copy the nexus-webapp-1.9.2.war to C:\apache-tomcat-7.0.23\webapps.
[*]2. Restart the tomcat server. Access sonar by http://localhost:8080/nexus .
[*]Note: We strongly recommend you use JDK 6. Because the nexus version 1.9.2 and 1.9.2.4 cannot work well with JDK 7 when I write this document.
[/list]
[b]Configuration[/b]
[list]
[b]Hudson[/b]
[*]1. Hudson needs some disk space to perform builds and keep archives. By default, this is set to windows user folder “ /.hudson”, but you can change this by adding environment variable “HUDSON_HOME".
[*]2. Open http://localhost:8080/hudson/ , and click “Manage Hudson” at left side, and then click “Configure system” to setup global configurations.
Some of the configurations are required; you cannot build successfully if you ignore them.
JDK: configure the java_home of java runtime.
Maven: specify the maven home path.
[img]http://dl.iteye.com/upload/attachment/0062/3342/7cb321b8-65ff-37e3-adc2-d6db5ade6cfb.jpg[/img]
[*]3. If you have installed sonar.hpi, you can see the following segment in the “Configure system” page.
[img]http://dl.iteye.com/upload/attachment/0062/3344/d9f778e3-6a5c-3d2c-abf8-4d3707dd1860.png[/img]
[*]set the following fields:
[*]Server URL : http://localhost:8080/sonar/
[*]Database URL: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
[*]Database Driver: com.mysql.jdbc.Driver
[*]Database login: sonar
[*]Database password: sonar
[*]4. At the same page, you can also set value for the “SMTP server”, so that Hudson will send mails to notify you when the build is broken or someone submitted error code to the SVN server.
[*]5. and click “New Job” at left side. Give a name of the project and choice Build a Maven 2/3 project (Legacy), click “OK” button to navigate to next page.
[img]http://dl.iteye.com/upload/attachment/0062/3348/ce294d32-4627-3424-9f7d-b0299825f257.jpg[/img]
[*]6. At the “Source Code Management” choose the “SVN” option, specify value for “Repository URL”, and you will be asked for username and password later. You’d better specify the full path directly point at the project source folder, so that Hudson can find the pom.xml easily without any further configurations.
[*]e.g. svn://svnserver/SEC/projects/Megafon SNAP PoC/source code/trunk/brtconnector
[img]http://dl.iteye.com/upload/attachment/0062/3352/3ea2a912-7df8-3795-8f2f-682d698f1b9c.jpg[/img]
[*]7. If your workspace has the top-level pom.xml in somewhere other than the module root directory, specify the path (relative to the module root) here, such as parent/pom.xml.
[*]If left empty, defaults to pom.xml
[*]8. If you have installed sona.phi plug-in, select the checkbox before “Sonar” at the bottom of the page at “Post build Action” section.
[img]http://dl.iteye.com/upload/attachment/0062/3354/9caa391c-1dc6-3f1c-a5b4-6b2e8f99d69a.png[/img]
[*]9. Click the “Save” button to save all changes.
[/list]
[b]Maven[/b]
Now open the "MAVEN_HOME\conf\setting.xml" and make some changes to make the Nexus take effective in maven.
   
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8080/nexus/</url>
</mirror>


And make the following changes to make sonar take effective in maven.

<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- EXAMPLE FOR MYSQL -->
<sonar.jdbc.url>
jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
</sonar.jdbc.url>
<sonar.jdbc.driverClassName>com.mysql.jdbc.Driver</sonar.jdbc.driverClassName>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<!-- optional URL to server. Default value is http://localhost:9000 -->
<sonar.host.url>
http://localhost:8080/sonar
</sonar.host.url>
</properties>
</profile>


<activeProfiles>
<activeProfile>sonar</activeProfile>
</activeProfiles>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值