How to auto build and deploy project
<o:p></o:p>
1 Prepare software environment<o:p></o:p>
1.1 copy “apache-ant-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">1.7.0</st1:chsdate>” to your computer<o:p></o:p>
For example: C:\apache-ant-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">1.7.0</st1:chsdate><o:p></o:p>
It is used to run ant script<o:p></o:p>
Copy “activation.jar” , “mail.jar” to C:\apache-ant-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">1.7.0</st1:chsdate>\lib. It is used by the <mail> task. <o:p></o:p>
Copy “activation.jar” to C:\apache-ant-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">1.7.0</st1:chsdate>\lib. It is used by the <ftp> task. <o:p></o:p>
You can see Library Dependencies for more information.<o:p></o:p>
1.2 copy “cruisecontrol-bin-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">2.6.1</st1:chsdate>” to your computer<o:p></o:p>
For example: C:\cruisecontrol-bin-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">2.6.1</st1:chsdate><o:p></o:p>
It is used to <o:p></o:p>
1.3 copy “selenium-remote-control-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">0.9.0</st1:chsdate>” to your computer<o:p></o:p>
For example: C:\ selenium-remote-control-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">0.9.0</st1:chsdate><o:p></o:p>
It is used to run selenium test<o:p></o:p>
<o:p> </o:p>
2 Set system environment variables <o:p></o:p>
2.1 set Java environment variables<o:p></o:p>
JAVA_HOME = D:\Program Files\IBM\JAVA50<o:p></o:p>
-- that is your java installed directory(JDK1.4 or JDK1.5 is OK)<o:p></o:p>
PATH = %JAVA_HOME%\bin;%PATH%<o:p></o:p>
CLASSPATH = .\;%JAVA_HOME%\lib\tools.jar<o:p></o:p>
2.2 set ant environment variables<o:p></o:p>
ANT_HOME = D:\apache_ant_<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">1.7.0</st1:chsdate><o:p></o:p>
-- that is your ant installed directory<o:p></o:p>
PATH = %ANT_HOME%\bin; %ANT_HOME%\lib<o:p></o:p>
<o:p> </o:p>
3 Write ant scripts<o:p></o:p>
The ant scripts contain all the work that you want to do. Normally, there will be the following target to build and deploy a web application: <o:p></o:p>
a) Build script<o:p></o:p>
Initiate: make the directory needed.<o:p></o:p>
Compile the source code.<o:p></o:p>
Copy the files which are needed to the associated directories.<o:p></o:p>
Replace some properties.<o:p></o:p>
Run the junit tests if there are.<o:p></o:p>
Build war package.<o:p></o:p>
Build ear package.<o:p></o:p>
b) Deploy script<o:p></o:p>
Upload the ear package to the target computer by ftp. (If you want to deploy in the local computer, skip this)<o:p></o:p>
Deploy by wsadmin.bat<o:p></o:p>
c) Create database script<o:p></o:p>
Use the <exec> task to run the db script.<o:p></o:p>
d) BVT test script<o:p></o:p>
Use the <junit> task to run the BVT test script<o:p></o:p>
Now you can build and deploy by cmd. The command is “ant –f filename -l logname”. -f to designate filename and -l to designate logfilename.<o:p></o:p>
Also you can write a bat file to run ant. This bat file will be run by cruisecontrol later. For example: <o:p></o:p>
File name: ant_CQP.bat<o:p></o:p>
File content: ant –f All_windows -l antlog_CQP.txt <o:p></o:p>
<o:p> </o:p>
4 Configure the cruise control<o:p></o:p>
There is a configuration file for cruise control. Usually, it is named config.xml. You can see the Configuration Reference for more.<o:p></o:p>
Here gives an example:<o:p></o:p>
<cruisecontrol><o:p></o:p>
<o:p> </o:p>
<property name="buildDir" value="C:\Build" /><o:p></o:p>
<property name="ccbuildDir" value="C:\CruiseControlBuild" /><o:p></o:p>
<property name="ccDir" <o:p></o:p>
value="C:\cruisecontrol-bin-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">2.6.1</st1:chsdate>\webapps\cruisecontrol" /><o:p></o:p>
<o:p></o:p>
<project name="CQP" buildafterfailed="false" requireModification="false"><o:p></o:p>
<o:p></o:p>
<property name="projectDir" value="M:\Daniel_CQP_Framework3.2_int"/><o:p></o:p>
<property name="buildscriptDir" <o:p></o:p>
value="meritage_deployandbuild\BuildScript"/><o:p></o:p>
<property name="reportDir" <o:p></o:p>
value="${buildDir}\${project.name}\test_report"/><o:p></o:p>
<property name="antlogDir" value="${ccbuildDir}"/><o:p></o:p>
<property name="antlog" value="antlog_${project.name}.txt"/><o:p></o:p>
<property name="antbat" value="ant_${project.name}.bat"/><o:p></o:p>
<o:p> </o:p>
<listeners><o:p></o:p>
<currentbuildstatuslistener <o:p></o:p>
file="${ccbuildDir}/logs/${project.name}/status.txt"<o:p></o:p>
/><o:p></o:p>
</listeners><o:p></o:p>
<o:p> </o:p>
<bootstrappers><o:p></o:p>
<clearcaseviewstrapper <o:p></o:p>
viewpath="${projectDir}" <o:p></o:p>
voblist="\meritage_framework"<o:p></o:p>
/><o:p></o:p>
</bootstrappers><o:p></o:p>
<o:p> </o:p>
<!-- schedule to build --><o:p></o:p>
<schedule interval="31104000"><o:p></o:p>
<!-- run command which is given in the right place --><o:p></o:p>
<exec <o:p></o:p>
command="${ccbuildDir}\${antbat}"<o:p></o:p>
workingdir="${projectDir}\${buildscriptDir}"<o:p></o:p>
/><o:p></o:p>
</schedule><o:p></o:p>
<o:p> </o:p>
<!-- directory to write build logs to --><o:p></o:p>
<log dir="${ccbuildDir}/logs/${project.name}"><o:p></o:p>
<merge dir="${reportDir}"/><o:p></o:p>
</log><o:p></o:p>
<o:p> </o:p>
<!-- Publishers are run *after* a build completes --><o:p></o:p>
<publishers><o:p></o:p>
<!—copy build to target directory --><o:p></o:p>
<artifactspublisher <o:p></o:p>
dest="${ccbuildDir}\artifacts\${project.name}"<o:p></o:p>
dir="${buildDir}\${project.name}"<o:p></o:p>
/><o:p></o:p>
<o:p></o:p>
<!—copy ant log to target directory --><o:p></o:p>
<artifactspublisher <o:p></o:p>
dest="${ccbuildDir}\artifacts\${project.name}"<o:p></o:p>
file="${ccbuildDir}\${antlog}"<o:p></o:p>
/><o:p></o:p>
<o:p></o:p>
<!-- send email to notify that build finished --><o:p></o:p>
<htmlemail<o:p></o:p>
buildresultsurl="http://9.181.106.125:8081/cruisecontrol/buildresults/${project.name}"<o:p></o:p>
xsldir="${ccDir}\xsl"<o:p></o:p>
css="${ccDir}\css\cruisecontrol.css"<o:p></o:p>
mailhost="9.181.32.76"<o:p></o:p>
returnaddress="zzheng@cn.ibm.com"><o:p></o:p>
<always address="zzheng@cn.ibm.com"/><o:p></o:p>
<always address="wangdsh@cn.ibm.com"/><o:p></o:p>
</htmlemail><o:p></o:p>
</publishers><o:p></o:p>
</project><o:p></o:p>
<o:p> </o:p>
</cruisecontrol><o:p></o:p>
<o:p> </o:p>
5 Run<o:p></o:p>
5.1 run selenium<o:p></o:p>
Selenium needs Java50 to run. If your JRE are not version 1.5, please setup the jdk1.5, and run selenium like the following command.<o:p></o:p>
"C:/Program Files/IBM/Java50/bin/java" -jar C:/selenium-remote-control-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">0.9.0</st1:chsdate>/server/selenium-server.jar<o:p></o:p>
If your JRE are version 1.5, then you can run selenium by the command bellowed.<o:p></o:p>
java -jar C:/selenium-remote-control-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">0.9.0</st1:chsdate>/server/selenium-server.jar<o:p></o:p>
You can write a bat file to run selenium easily.<o:p></o:p>
5.2 run cruisecontrol<o:p></o:p>
Use the cmd to run cruisecontrol. <o:p></o:p>
C:\cruisecontrol-bin-<st1:chsdate isrocdate="False" month="12" islunardate="False" day="30" w:st="on" year="1899">2.6.1</st1:chsdate>\cruisecontrol.bat -configfile C:\CruiseControlBuild\config.xml -webport 8081<o:p></o:p>
Use -configfile to designate configuration file, and use -webport to designate port.<o:p></o:p>
Also, you can write a bat file to run selenium easily.<o:p></o:p>
<o:p> </o:p>
6 Build and deploy project<o:p></o:p>
Open the web page: http://localhost:8081<o:p></o:p>
Click the button build.<o:p></o:p>
分享到:
相关推荐
It has the potential to impact every aspect of computing, from the application development process to how applications are deployed and scaled up and out across massive data centers. Despite its ...
Unity in Action teaches you how to write and deploy games. You'll master the Unity toolset from the ground up, adding the skills you need to go from application coder to game developer. Each sample ...
A tutorial about effectively building Scala ... Along the way, you’ll work through real projects that demonstrate how to build and deploy your projects regardless of development methodology or process.
What You'll Learn Build and deploy a simple company site with Django Develop more complex, data-heavy sites using the Django ORM Integrate Django with Channels Unit-test your solutions Who This Book ...
Blockchain concepts ...By the end of this book, you will be able to build and deploy your own decentralized applications using Hyperledger addressing key pain points encountered in blockchain lifecycle.
Packed with examples, you'll also learn how to create a build system to test and deploy your JavaScript project by optimizing the code. Next, you will move on to learn about DOM optimization, ...
Computer vision is found everywhere in ... By the end of this chapter, you will be able to understand how neural networks work and how to apply them to machine learning to build advance images tools.
Learn how to use Gradle's powerful dependency management through extensive code samples, and discover how to define, customize, and deploy dependencies About This Book Be in total control of your ...
This book will teach readers how to build and deploy a fully working example retail website using Microsoft ASP.NET MVC and Entity Framework technologies and recommendations. This book contains ...
This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques, and options you can use. Furthermore, it explains the UI and API building blocks so ...
Then we will learn how to prepare, build, and deploy functions with its provided tools and templates, how to prepare its cluster on top of Swarm, how to use its user interface, and how OpenFaaS ...
In the final chapters, you'll be introduced to some programming and debugging tricks and finally, you will be shown how to test and deploy the project to a remote dedicated server. By the end of ...
Packed with examples, you'll also learn how to create a build system to test and deploy your JavaScript project by optimizing the code. Next, you will move on to learn about DOM optimization, ...
This appendix covers how the local build process works and also how to start up Docker locally if you want to run the code examples locally. Appendix B is supplemental material on OAuth2. OAuth2 is ...
Authors Jon Manning and Paris Buttfield-Addison (iOS Swift Game Development Cookbook) provide a top-to-bottom overview of Unity’s features with specific, project-oriented guidance on how to use them ...