building different test and production versions with ANT

S

stephenfu1

Hi

I have a java file called ParameterParsing

There is some code that needs to be commented or uncommented depending
on if you wish to deploy to a production or test environment.

Can this be automated using an ANT build script?

Thanks
 
R

Raymond DeCampo

Hi

I have a java file called ParameterParsing

There is some code that needs to be commented or uncommented depending
on if you wish to deploy to a production or test environment.

The standard way of doing this in Java is not to use a preprocessor but
to use an idiom like

if (Environment.TEST)
{
// test only code
}

where Environment.TEST is a final static boolean. When it is false the
compiler will optimize away the body of the if statement.
Can this be automated using an ANT build script?

You could use two different classpaths for production and test builds,
where the Environment class is the only thing different.

HTH,
Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top