[default: the Hudson and SVN is working but there is no maven project on them]

1.1.       download maven , set MAVEN_HOME and path. test it if it has been installed successfully: cmd: mvn –version(note: only if u have set the JAVA_HOME) . u will see a lot of information including java version.

 

2.2.       Download Sonar to local. Start the “StartSonar.bat” file and visit localhost:9000.

3.3.       Do something for preparing the environment for maven project in NetBeans: set the tools->options->maven->ExternalMavenHome

4.4.       New a Maven project-> MavenQuickStart(this is enough) in NetBeans. Or you can use this command in cmd:  mvn archetype:create -DgroupId=com.PRFT.sele -DartifactId=web

5.      5. You may need some external libraries that cannot be found on search.maven.org, then you can try this: download the jar you need, and goto cmd: cd “project address”; type in: mvn install:install-file -Dfile=selenium-server-standalone-2.4.0.jar -DgroupId=selenium_project -DartifactId=selenium -Dversion=2.4.0 -Dpackaging=jar   [Dfile is the name of the jar file. After doing this, u will find that jar is added into your {$user$}/.m2/repository/{$DgroupId$}/{$DartifactId$}/ folder]

6.       6.Go to visit the Hudson server website( localhost:8080/hudson or something else).

Manage Hudson-> manage plugins-> install: maven, svn, sonar, cobertura plugins.

New job->  

Choose svn and set the Repository URL:


new maven project on CI(hudson+maven+svn+sonar)_休闲

Auto build time setting:


new maven project on CI(hudson+maven+svn+sonar)_maven_02

 

new maven project on CI(hudson+maven+svn+sonar)_sonar_03

Tick sonar up in post-build action :


new maven project on CI(hudson+maven+svn+sonar)_maven_04

7   7.       Add sonar to Hudson server( so you don’t have to download sonar on your own computer)

Add this code below into {$MAVEN_HOME$}/conf/settings.xml:

<profiles>

                ….

             (add from here)

<profile>

                             <id>sonar</id>

                           <activation>

                                       <activeByDefault>true</activeByDefault>

                            </activation>

                           <properties>

                                       <sonar.host.url>http://SONAR_SERVER:9000</sonar.host.url>

                        </properties>

                        </profile>

 

……(onther profile)

 

</profiles>

 

Click SAVE.

DONE.