Command to run Build Script - Google Code

greasyservantInternet και Εφαρμογές Web

30 Ιουλ 2012 (πριν από 5 χρόνια και 20 μέρες)

329 εμφανίσεις

This is
a generic
build script for
web admin
.

Files/Folders structure:




runtime

(
Folder
)


A folder for Jars needed by script

o
u
t
put

(
Folder
)


The folder for storing the ear file

and JUnit

R
eport files.


workspace

(
Folder
)


An eclipse workspace folder fo
r
putting state’s eclipse projects

config (
Folder
)


A folder includes
some

configuration files.

For example,

1.

common
.properties
:
It includes s
ome
common
variables
, such as
WEBSPHERE and SVN configuration.

2.

config.
??
.properties
, it’s a c
onfiguration file for

each Web Admin application
.

Such as, config.fl.properties, config.wi.properties


build.xml


ANT SCRIPT
contains

check
-
out, compile
,
unit test,
package

ear

tasks and
etc.

build
.bat


Windows batch entry

which used

for
invoking the
script build.xml


deploy.x
ml


It’s a s
cript for

deploy
ing

EAR project
to

WEBSPHERE SERVER.


deploy.bat


Windows batch entry
which used for invoking
script deploy.xml


setenv.bat

It used to s
et

some environment
s

variables

for
package.bat

and deloy.bat.


BuildUtils.xml



Some common

ant

Task and Macro
.

mailTemplate.html


Email
content
template
.


















Environment
Setting:

Before

run the build script, w
e need to do some setti
ng for the RAD.

1)

Please copy
the entire

Build S
cript

into your local
disk.

2)

Launch RAD and
choose

the
w
orkspace

F
older in B
uild

S
cript project as the eclipse
workspace.

For example,












3)

Since t
he ANT in RAD doesn’t
support
JUNIT

function
, we have to change one
.

Go
to

window
-
>preference
-
>Ant
-
>runtime
, select
Ant H
ome Entries

of Classpath tab,
and t
hen

click
on

“Ant Home” button to change the ANT_HOME

to the ANT in
runtime

folder of
Build Script project
.

For example,









4)

Check out the Share Jars to
workspace

folder
.
Go
to

window
-
>preference
-
>
Plug
-
in
Development
-
>
Target Platform
, and then chan
ge
the target platform location
references to the “target platform” folder in SharedJar

project
in

workspace

folder
of

Build Script
.

For example,





Projects configuration for different states
:



If you want to run the build work, do please make sure you d
id last
section
’s
configuration works

about projects

for different states
:


1.

Go to
config

folder. Open
common.properties

change the configuration
properties

if you need
, this configuration is common for all states
.


#Share Jars project Setting

shareJarProj
ectName=Shared
Jars


#SVN

svn.shareJar.url=http://006devtools
-
vs2/svn/hf/Shared Jars/
trunk


svn.username=alex_zhang

svn.password=pwd


#RAD

RAD.home.dir=C:
\
\
RAD7


#ECLIPSE WORKSPACE

workspace.dir=
workspace


#websphere home directory

was.home.dir=C:
\
\
RA
D7
\
\
runtimes
\
\
base_
v61


#config about
email

mail.host=Smtp.cbc.cts

mail.port=25

mail.startSSL=false

mail.user=

mail.password=

mail.subject=Build script result report

mail.from=HF_Auto_Build

#in Prod environment, use "_16ae3@ctsinc.biz"

mail.to=_16ae3@ctsinc.biz


Usually, you just need to change the
SVN

account and the “mail.to” properties.


2.

Create
configuration

file
for project
s for specific state
.
The name
convention

must be “config.
*.properties”, such
as config.fl.properties,
config.wi.properties and config.mo.properties.
The configuration should be
like this
,


#Project Infomation

EARProjectName=
FLHFWebAdminEAR

TestProjectName=
FLTests


#SVN path

# The realated projects

#svn.project.
related
=

#
The

pro
ject branches or trunk path. And please make sure the
URL

path is begin with http://

svn.project.url=http://006devtools
-
vs2/svn/hf/Florida/web admin/
branches


#WebSphere Server parameters

was.host=cbcwashfdev
-
vs1.CBC.CTS

was.username=p001001bob

was.passwo
rd=pwd

was.
soap.port=8879

was.profile=Dmgr01

was.cell=DevHFCell01

#Cluster Configuration, if there is no cluster you can skip these

was.node=Node01

was.cluster=FLHF_Cluster

was.cluster.member=FLHF_Cluster_Node01


If you need to deploy your application to l
ocal server, similar to this:


was.host
=localhost

was.username
=p001001bob

was.password
=pwd

was.soap.port
=8880

was.profile
=AppSrv01

was.cell
=HF
-
V10006Node01Cell

was.node
=HF
-
V10006Node01

Please change the “
was.profile
”,”

was.cell
” and “
was.node


to yours.



Command to run B
uild

S
cript:

After all the setting and configuration
, you could run build script to build projects.
There are two types of command used for doing batch process and the manually build
work.
After every build process finished, there would

be an email send to your email box
no matter whether it’s success.


1.

B
atch

process

Batch process is
designed

for CI tool to do daily scheduled building

work
. Its
responsibility is
for building

(checkout, compile and junit test)

all the projects
under

bra
nches or trunk

according to the configuration files you defined
.


The command is:
build batch


The build script will scan all the configurations under config folder and retrieve
the SVN paths. These paths should be branches or trunk. For example, if I wa
nt
to build all branches for FL, I have to set
svn.project.url

property’s value to
http://006devtools
-
vs2/svn/hf/Florida/web admin/
branches
, and then the build
script will scan the branches folder and get all branches’ URL to check out the
source to do the

building works.


2.

Manual building work

Often, you have the chance to run the specified project.


The command is:
build
-
Dstate=fl
-
Durl=

http://006devtools
-
vs2/svn/hf/Florida/web admin/branches/UAT Support




For the above command, you don’t need to speci
fy
which

ANT target
need to run, because the default target is manual. However, you have to set two
properties: state and the URL. The former is to specify which state’s project you
want to build

(the state name is depend on the middle string of config
.
fl
.
properties
file)
, and the la
t
ter is the project’s SVN path.


For manual building work as above command, it will checkout, compile,
and junit test Project, if you also want to export package and deploy the package
into the WS server, you should add another
argument

‘target’ (which should be
“junit”, ‘package’, or ‘deploy’)

as bellow:


The command is:
build

-
Ds
t
ate=fl

-
Dtarget=deploy
-
Durl=”
http://006devtools
-
vs2/svn/hf/Florida/web admin/branches/UAT Support



Tips:

1.

Customizes the properties

in command


S
ince our build script is mainly based on the ANT and eclipse
-
based plug
-
in
development technologies, it inherits any usages from them. For example, sometimes,
you have to change the email address when you’re building. You can change it when you
are run the

command: build
-
Dsate=…
-
Dmail.to=user@activejc.com

… So, you can
dyna
mi
cally
change

every property you can find in configuration files when you’re
running command.