Site Search :
Standard Enterprise XML Methodology Pattern Setting Tunning Other
Article Contributors
GuestBook
Javapattern Maven
XSourceGen Dev
JetSpeed Test
JLook Image
jLook Family Site


IBM Webshpere 5.0 ÀÇ ¼­¹ö½ÃÀÛ, ÁßÁö ¹× EJB Deploy ANT Build
 
IBM Webshpere 5.0 ÀÇ ¼­¹ö½ÃÀÛ°ú ÁßÁö, EJB Deploy¸¦ ANTÀÇ ½ºÅ©¸³Æ®¸¦ ¸¸µé¾î³»¾î ó¸®ÇÒ ¼ö ÀÖµµ·Ï properties¹× build.xmlÆÄÀÏÀ» ¸¸µé¾îº»´Ù. ( 2003/07/09 ) 230
Written by ienvyou - ÃÖÁö¿õ
1 of 1
 

À̹ø ¾ÆƼŬ¿¡¼­´Â À¥½ºÇǾîÀÇ ±¸µ¿¿¡ ´ëÇÑ ANT build ÆÄÀÏ ¹× websphere deploy¿ë 
ANT Task DefineÀ» Á¤ÀÇÇغ¸°íÀÚ ÇÑ´Ù.

ÇöÀç ³ª¿ÍÀÖ´Â K»ý¸í»çÀÇ °³¹ßȯ°æÀÌ À¥½ºÇǾîÀε¥ ÀÚ¼¼ÇÑ »çÇ×Àº º¸¾È»ó ÇÏÁö ¾Ê°Ú´Ù.

ÀÌŬ¸³½º¸¦ ³»ÀåÇÑ WSAD¸¦ »ç¿ëÇÏ¿© EJB¸¦ ¸¸µé°í ÇÏ¸é ½±°ÚÁö¸¸ ÇöÀç ³î»õ~´Â ¸ðµç
¿£ÅÍƼºó¿¡ ´ëÇÑ Äڵ带 ½À°ü»ó text base¸¦ ÀÌ¿ëÇÏ¿© Ç×»ó ¸¸µé°í ÀÖ´Ù.

¿©±â¼­ º¼°ÍÀº À¥½ºÇǾî 5.0À» ant task·Î startup ¹× shutdownÀ» ½Ãų ¼ö ÀÖµµ·Ï ¸¸µé¾úÀ¸¸ç
»ý¼ºµÈ ejb¸¦ À¥½ºÇÇ¾î ¸Þ´ºÁß Àü°³µÈ EJBÄÚµå »ý¼º ¾øÀÌ ºü¸¥ ½Ã°£¾È¿¡ admin tool¿¡¼­ 
deploy½Ãų ¼ö ÀÖµµ·Ï ȯ°æ±¸¼ºÀ» Çϵµ·Ï ÇÑ´Ù.

º°¹Ý ´Ù¸¥ ÁÖº¯È¯°æÀ» ¼³¸íÇÒ ÇÊ¿äµµ ¾ø°í, ´ç½ÅÀÌ ¸¸¾à ÀÌ·¯ÇÑ °ÍÀÌ ÇÊ¿äÇÏ´Ù¸é
¾ðÁ¨°¡´Â À̱ÛÀ» ÇÊ¿ä¿¡ ÀÇÇÏ¿© ÀÐÀ» °ÍÀ̹ǷÎ, ¼³¸íÀº ÃÖ´ëÇÑ °£´ÜÇÏ°Ô Çϵµ·Ï ÇÏ°Ú´Ù.

¿ì¼± Webshpere¿¡ ´ëÇÑ È¯°æÀÌ ¼³Á¤ÀÌ build.xmlÆÄÀÏ¿¡ ÇÊ¿äÇϹǷΠÀ̸§ÇÏ¿© build.propertiesÆÄÀÏÀ»
¼±¾ðÇÏ¿© ¿ì¸®°¡ ÇÊ¿äÇÑ º¯¼ö¸¦ ¼±¾ðÇϵµ·Ï ÇÑ´Ù.

¿¹Á¦´Â ¾Æ·¡¿Í °°´Ù.

¢º build.properties


#choose classic, modern, jikes, or jvc
#
#±âº»ÀûÀÎ javac¸ðµâÀº IBM¿¡¼­ Á¦°øÇÏ´Â JDK¸¦ ÀÌ¿ëÇÏ¿© ¼­¹ö¸¦ ±¸µ¿ÇÏ¿©¾ß ÇÑ´Ù.
#ANTÀÇ ±âº»¸ðµâÀº »ó°üÀÌ ¾øÀ¸¸ç, ¿¬°áµÈ ¼­¹ö¸¸À» ÀÌ¿ëÇÑ´Ù.
#
JAVAC=modern
#ÀÚ¹ÙÄÄÆÄÀÏ·¯ÀÇ À§Ä¡¸¦ ÁöÁ¤ÇØÁØ´Ù.
java.home=C:/IBM/WebSphere/AppServer/java

#Config URLÀ» ¼¼ÆÃÇÑ´Ù.
com.ibm.SOAP.ConfigURL=C:/IBM/WebSphere/AppServer/properties/soap.client.props
com.ibm.CORBA.ConfigURL=C:/IBM/WebSphere/AppServer/properties/sas.client.props

#ÀÎÄÚµùµÈ °á°ú°ªÀÇ Ãâ·ÂÀ§Ä¡¸¦ ÁöÁ¤
ws.output.encoding=console 

# ¼­¹ö±¸µ¿ ¹× deploy¿¡ ÇÊ¿äÇÑ Å¬·¡½º¸¦ Ãß°¡ÇÏ¿© »ç¿ëÇϵµ·Ï ÇÑ´Ù.
ws.classpath=C:/IBM/WebSphere/AppServer/properties; \n
C:/IBM/WebSphere/AppServer/lib/bootstrap.jar; \n
C:/IBM/WebSphere/AppServer/lib/j2ee.jar;C:/IBM/WebSphere/AppServer/lib/lmproxy.jar; \n
C:/IBM/WebSphere/AppServer/java/jre/lib/ext/mail.jar; \n
C:/IBM/WebSphere/AppServer/lib/wasjmx.jar; \n
C:/IBM/WebSphere/AppServer/lib/processmgmt.jar

# À¥½ºÇǾî ÀνºÅçµð·ºÅ丮¸¦ ÁöĪÇÑ´Ù.
was.install.root=C:/IBM/WebSphere/AppServer

#À¥½ºÇǾî È®Àå¶óÀ̺귯¸® µð·ºÅ丮¸¦ ¼±¾ðÇÑ´Ù.
ws.ext.dirs=C:/IBM/WebSphere/AppServer/java/lib;C:/IBM/WebSphere/AppServer/classes; \n
C:/IBM/WebSphere/AppServer/lib; \n
C:/IBM/WebSphere/AppServer/lib/ext; \n
C:/IBM/WebSphere/AppServer/web/help; \n
C:/IBM/WebSphere/AppServer/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime;

# ¼­¹ö½ÃÀÛ°ú Á¾·á¿¡ ÇÊ¿äÇÑ Å¬·¡½º°¡ launcher·Î ÀԷµǵµ·Ï ÇÑ´Ù.
stop.class=com.ibm.ws.management.tools.WsServerStop
start.class=com.ibm.ws.management.tools.WsServerLauncher

# ȯ°á¼³Á¤µð·ºÅ丮¸¦ ÁöÁ¤ÇÑ´Ù.
config.root=C:/IBM/WebSphere/AppServer/config

# cell ¸Ó½Å
was.cell=spider

# ³ëµå ¸Ó½Å
was.node=spider

# ¼­¹öÀÇ À̸§À» ÁöÁ¤ÇÑ´Ù.
server.name=server1

# ¼­¹ö¸¦ ±¸µ¿½ÃÅ°±â À§ÇÑ ½ÇÇàÆÄÀÏÀ» ÁöÁ¤ÇÑ´Ù.
execute.class.name=com.ibm.ws.bootstrap.WSLauncher

ÀÌÁ¦ Ant·Î startup, shutdown½Ãų ¼ö ÀÖµµ·Ï build.xmlÆÄÀÏÀ» ¼³Á¤ÇÑ´Ù. ¢º build.xml


    <project name="Handling_websphere_by_Carouser" default="help" basedir=".">

    <!-- set global properties for this build -->
    <property environment="env"/>
    <property file="./build.properties"/>

    <target name="help">
    <echo>
        Websphere Application Server Handling
        Toplevel targets:
           help		-- 	this message
           stopserver		--	stop the WAS5.0
    </echo>
    </target>

    <!-- #### IBM Websphere Appliation Server start ########## -->
    <target name="startserver">
    <!-- Create the time stamp -->
    <tstamp/>
    <echo>${ws.classpath}</echo>

    <!-- Create the build directory structure used by compile -->
    <java classname="${execute.class.name}" fork="yes">
        <jvmarg value="-Dcom.ibm.CORBA.ConfigURL=${com.ibm.CORBA.ConfigURL}"/>
        <jvmarg value="-Dws.output.encoding=${ws.output.encoding}"/>
        <jvmarg value="-Dwas.install.root=${was.install.root}"/>
        <jvmarg value="-Dws.ext.dirs=${ws.ext.dirs}"/>

         <arg value="${start.class}"/> 
         <arg value="${config.root}"/> 
         <arg value="${was.cell}"/> 
         <arg value="${was.node}"/> 
         <arg value="${server.name}"/> 
         <classpath>
            <pathelement path="${ws.classpath}"/>
         </classpath>
    </java>
    </target>
    <!-- ##### IBM Websphere Appliation Server start target End ######  -->



    <!-- ###### IBM Websphere Appliation Server stop ##### -->
    <target name="stopserver">
    <!-- Create the time stamp -->
    <tstamp/>
    <echo>${ws.classpath}</echo>

    <!-- Create the build directory structure used by compile -->
    <java classname="${execute.class.name}" fork="yes">

        <jvmarg value="-Dcom.ibm.SOAP.ConfigURL=${com.ibm.SOAP.ConfigURL}"/>
        <jvmarg value="-Dcom.ibm.CORBA.ConfigURL=${com.ibm.CORBA.ConfigURL}"/>
        <jvmarg value="-Dws.output.encoding=${ws.output.encoding}"/>
        <jvmarg value="-Dwas.install.root=${was.install.root}"/>
        <jvmarg value="-Dws.ext.dirs=${ws.ext.dirs}"/>

         <arg value="${stop.class}"/> 
         <arg value="${config.root}"/> 
         <arg value="${was.cell}"/> 
         <arg value="${was.node}"/> 
         <arg value="${server.name}"/> 
         <classpath>
            <pathelement path="${ws.classpath}"/>
         </classpath>
    </java>
    </target>
    <!-- #########IBM Websphere Appliation Server stop target End ##### -->

    </project>


´ç½ÅÀÌ À§ÀÇ build.propertiesÁ¤µµ¸¸ ȯ°æ¿¡ ¸Â°Ô²û ¼öÁ¤ÇÏ¿© ÇÁ·ÒÇÁÆ® â¿¡¼­ $build_home>ant startserver ¶ó°í¸¸ ÀÔ·ÂÇÏ°Ô µÇ¸é ¼­¹ö¸¦ ±¸µ¿À» ½ÃÀÛÇÒ °ÍÀ̸ç $build_home>ant stopserver ¶ó°í ÀÔ·ÂÇÏ°Ô µÇ¸é ¼­¹ö´Â ÀÛµ¿À» ÁßÁöÇÒ °ÍÀÌ´Ù. " ù¹ø° ´Ü°è"¶ó´Â À¥½ºÇǾî ÅøÀÌ ÀÖ±â´Â ÇÏÁö¸¸ BSDȯ°æÀ̶ó¸é À§ÀÇ ½ºÅ©¸³Æ®°¡ ±²ÀåÈ÷ À¯¿ëÇÏ°Ô ¾²ÀÏ °ÍÀÌ´Ù. ¿Ö³Ä~ MakefileÀ» ´Ù½Ã ¸¸µé ÇÊ¿ä°¡ ¾ø±â ¶§¹®ÀÌ´Ù. ÀÚ. ÀÌÁ¦ ±×·¯¸é ejb¸¦ Çϳª ÀÛ¼ºÇß´Ù°í ÇßÀ»¶§ ±× ejb¸¦ webshpere¿ëÀÇ Àü°³ÄÚµå¿ëÀ¸·Î »ý¼º±îÁö ½Ãų¼ö ÀÖ´Â task¸¦ defineÇغ¸µµ·Ï ÇÏÀÚ. À¥·ÎÁ÷¿ë ejbc¸¦ Æ÷ÇÔÇÑ °Ç ÀÌ¹Ì °³¹ß¾ÆƼŬÀÎ ¾Æ·¡ÀÇ ±ÛÀ» º¸µµ·Ï Ç϶ó. Weblogic EJB Deploy using ANT build ¾Æ·¡´Â À¥·ÎÁ÷°ú °°Àº °æ¿ìÀÎ À¥½ºÇǾî¿ë ejb deploy task¸¦ º¸¿©ÁÖµµ·Ï ÇÏ°Ú´Ù. ¢º build.properties

#choose classic, modern, jikes, or jvc
JAVAC=modern
#JAVA_HOME=/export/home/bea/jdk141_02
PROJECT_HOME=.
APPLICATIONS=.

# À¥½ºÇǾî Ȩµð·ºÅ丮
websphere.home=C:/IBM/WebSphere/AppServer

# Ŭ·¡½º Æнº
build.classpath=.;C:/IBM/WebSphere/AppServer/lib/j2ee.jar; \n
C:/IBM/WebSphere/AppServer/java/jre/lib/ext/ibmorb.jar; \n
C:/IBM/WebSphere/AppServer/lib/lmproxy.jar; \n
C:/IBM/WebSphere/AppServer/lib/bootstrap.jar; \n
C:/IBM/WebSphere/AppServer/java/jre/lib/wsexception.jar

#¼­¹öÀÇ µðÇ÷ÎÀÌ µÇ¾îÁ®¾ß ÇÒ µð·ºÅ丮
dist.server=D:/temp/test_war.ear

# ejb°¡ µðÇ÷ÎÀÌ µÇ¾îÁú Ŭ·¡½ºÆÄÀϵéÀÇ À§Ä¡
build.target.class.dir=build

# ejb dtd°¡ ÀÖ´Â IBM hostµð·ºÅ丮
dtd.home=C:/IBM/WebSphere/AppServer/deploytool/itp/plugins/com.ibm.etools.j2ee
¢º build.xml

<project name="ejb-basic-statelessSession" default="all" basedir=".">

  <!-- set global properties for this build -->
  <property environment="env"/>
  <property file="./conf/build.properties"/>
  <property name="build" value="build"/>
  <property name="dist" value="dist"/>
  <property name="jar.name" value="Increment"/>


<!-- Classpath Declaration -->
<path id="compilation-classpath">
	<pathelement path="${build.classpath}"/>
	<fileset dir="${dist}">
		<include name="**/*.jar"/>
		<include name="**/*.zip"/>
	</fileset>
</path>


  <target name="all" depends="init, compile_ejb, jar_ejb, deploy, clean"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile
    and copy the deployment descriptors into it-->
    <mkdir dir="${build}"/>
    <mkdir dir="${build}/META-INF"/>
    <mkdir dir="${dist}"/>
    <copy todir="${build}/META-INF">
      <fileset dir="xml">
        <include name="*.xml"/>
		<include name="*.*xmi"/>
        <exclude name="build.xml"/>
      </fileset>
    </copy>
  </target>
  

  <!-- Compile ejb classes into the build directory (jar preparation) -->
  <target name="compile_ejb" depends="init">
  	<echo>${build.classpath}</echo>
    <javac srcdir="." destdir="${build}" classpath="${build.classpath}"/>
  </target>

  <!-- Make a standard ejb jar file, including XML deployment descriptors -->
  <target name="jar_ejb" depends="compile_ejb">
    <jar jarfile="${dist}/_${jar.name}.jar"
      basedir="${build}">
    </jar>
  </target>


<target name="deploy" depends="jar_ejb">
  <taskdef name="wsejbdeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy">
      <classpath>
        <fileset dir="${websphere.home}/lib">
          <include name="*.jar"/>
        </fileset>
      </classpath>
    </taskdef>

	<wsejbdeploy inputJar="${dist}/_${jar.name}.jar"
 		wasHome="${websphere.home}"
 		workingDirectory="${dist}"
 		outputJar="${dist}/${jar.name}.jar"
		classpathref="compilation-classpath" />
</target>



  <target name="clean">
    <delete dir="${build}"/>
	<delete file="${dist}/_${jar.name}.jar"/>
    <delete dir="ejbcgen"/>
  </target>
</project>


EJBÀÇ µðÇ÷ÎÀÌ ¼ø¼­´Â targetÀÇ allÀÇ depends¸¦ º¸¸é ¾Ë°ÚÁö¸¸ ¿ì¼± init - Ãʱâ ȯ°æ¼³Á¤ compile_ejb - ejb¼Ò½º ÄÄÆÄÀÏ jar_ejb - jarÆÄÀÏ·Î º¯È¯ deploy - À¥½ºÇǾî¿ë deployÄÚµå »ý¼º clean - »ý¼ºµð·ºÅ丮 »èÁ¦ ÀÇ ¼øÀ¸·Î ÀÌ·ç¾îÁø´Ù. ANT¸¦ Á¶±ÝÀÌ¶óµµ ´Ù·é ´ç½ÅÀ̶ó¸é º°·Î ¾î·ÆÁö ¾ÊÀ» ³»¿ëÀ¸·Î º¸ÀδÙ. ¼öÁ¤ÇØÁà¾ß ÇÒ°ÍÀº build.xmlÆÄÀÏÀÇ <property name="jar.name" value="Increment"/> ºÎºÐÀε¥ build.xmlÆÄÀÏÀ» ¼öÁ¤ÇÏ°í ½ÍÁö ¾Ê´Ù¸é ÇØ´ç ÇÁ·ÎÆÛƼ¸¦ confÀÇ È¯°æÀ¸·Î ¼³Á¤Çصµ ¹«¹æÇÒ °ÍÀÌ´Ù. ¾îÂî °íÄ¡µçÁö ³î»õ~´Â »ó°üÀÌ ¾ø´Ù. °ÇÅõ¸¦ ºô¸ç ±Ã±ÝÇÑ »çÇ×ÀÌ ÀÖÀ¸¸é ³î»õ~³× °Ô½ÃÆÇÀÌ ¾øÀ¸¹Ç·Î ¹æ¸í·Ï¿¡ ±Û³²±â±â ¹Ù¶õ´Ù. ´Ü±µ~!
 
1
References
 
Copyright ¨Ï 2003 www.javapattern.info & www.jlook.com, an jLOOK co.,LTD