cool hit counter
Cafe4Java
Cafe4Java
 
Configuration issues with Deployment of Java projects on different servers
< Previous    Page 1    2    3    4    Next >

PART 2 : Role of Java Application Deployer

To supply server specific values to an application, Application deployer can either:
  • Edit build.properies: Modify the actual values in build.properties file
  • Edit build.xml:Create a new properties file, say, build.properties.testingserver, and specify this file as the property file in the build.xml.
1)Edit build.properties:
An application deployer can easily edit the values in the file build.properties, which is a plain text file. In this case no modifications need to be made to any other file.

Following is an example of the modified build.properties file for, say, application testing server (another server):

build.properties

cafe4java.mailserver=testingserver----smtp.cafe4javamailserver.com
cafe4java.mailserver.user=testingserver----usercafe4java@cafe4java.com
cafe4java.mailserver.user.password=testingserver----pwdcafe4java
com.cafe4java.testapp.src=c:/cafe4javaProjectContext/src
com.cafe4java.testapp.build=c:/cafe4javaProjectContext/build
2)Edit build.xml:
Edit build.xml and specify new value for the property 'file'. Instead of modifying the build.properties file, an application deployer can define another text file for the new server and supply its name as the property file in the file 'build.xml'.

Following is an example of the modified build.xml file for, say, application testing server (just one is modified: marked in bold):

build.xml

<project name="cafe4java" default="build" basedir=".">
<description> Cafe 4 Java: Using Properties file with Ant</description>

    <target name="build" >
        <property file="build.properties.testingserver"/>
        <property name="src" location="${com.cafe4java.testapp.src}"/>
        <property name="build" location="${com.cafe4java.testapp.build}"/>

        <tstamp/>

        <filter token="CAFE4JAVA_SMTPHOST" value="${cafe4java.mailserver}"/>
        <filter token="CAFE4JAVA_SMTPAUTHUSER" value="${cafe4java.mailserver.user}"/>
        <filter token="CAFE4JAVA_SMTPAUTHUSERPASSWD" value="${cafe4java.mailserver.user.password}"/>

        <delete dir="${build}" />
        <!-- Create the build directory structure used by compile -->
        <mkdir dir="${build}"/>

	<copy 	file="${com.cafe4java.testapp.src}/com/application.properties"
			todir="${com.cafe4java.testapp.build}/classes/com"
			filtering="true"
			overwrite="true" />

        <javac srcdir="${src}" destdir="${build}/classes"/>

    </target>

</project>

build.properties.testingserver

Following is an example of the newly created file build.properties.testingserver file for testing (another) server:

cafe4java.mailserver=testingserver----smtp.cafe4javamailserver.com
cafe4java.mailserver.user=testingserver----usercafe4java@cafe4java.com
cafe4java.mailserver.user.password=testingserver----pwdcafe4java
com.cafe4java.testapp.src=c:/cafe4javaProjectContext/src
com.cafe4java.testapp.build=c:/cafe4javaProjectContext/build
< Previous    Page 1    2    3    4    Next >

Submit your feedback on this article


 
 
Custom Search
     
Cafe4Java