Fight the Future

Java言語とJVM、そしてJavaエコシステム全般にまつわること

WeblogicでEJBを動的デプロイする

    <taskdef name="wldeploy"
            classname="weblogic.ant.taskdefs.management.WLDeploy"
            classpath="${wl-home.dir}/server/lib/weblogic.jar" />

   <!-- - - - - - - - - - - - - - - - - -
          target: archive-ejb                     
         - - - - - - - - - - - - - - - - - -->
   <target name="archive-ejb" description="EJBをJARにアーカイブします。">
      <copy todir="${meta-inf.dir}">
         <fileset dir=".">
            <include name="ejb-jar.xml" />
            <include name="weblogic-ejb-jar.xml" />
         </fileset>
      </copy>
      <jar destfile="EJBの名前.jar">
         <fileset dir="../bin">
            <include name="/**/*.*" />
            <include name="META-INF/*.*" />
         </fileset>
      </jar>
   </target>

   <!-- - - - - - - - - - - - - - - - - -
          target: wldeploy
         - - - - - - - - - - - - - - - - - -->
   <target name="wldeploy"
           depends="archive-ejb"
           description="EJBのJARファイルをWeblogicにデプロイします。">

      <copy todir="${Weblogicのアプリケーションディレクトリ}">
         <fileset dir=".">
            <include name="EJBの名前.jar" />
         </fileset>
      </copy>

      <wldeploy action="deploy"
                source="${Weblogicのアプリケーションディレクトリ}/EJBの名前.jar"
                name="EJBの名前"
                user="${wl-user}"
                password="${wl-password}"
                adminurl="t3://localhost:7001"
                deltafiles="EJBの名前.jar"
                debug="true"
                library="true" />

   </target>

   <taskdef name="wlappc"
            classname="weblogic.ant.taskdefs.j2ee.Appc"
            classpath="${wl-home.dir}/server/lib/weblogic.jar" />

   <!-- - - - - - - - - - - - - - - - - -
          target: precompile
         - - - - - - - - - - - - - - - - - -->
   <target name="precompile"
           description="すべてのEJBをプリコンパイルします。2,3分時間がかかるので注意してください。その代わり、アプリケーションの初回動作が速くなります。結合テストのときなどに利用してください。">
      <path id="classpath">
         <pathelement location="${wl-home.dir}/server/lib/weblogic.jar" />
         <pathelement location="コンパイルに必要なJAR" />
      </path>
      <wlappc source="EJBの名前.jar"
              output="EJBの名前.jar"
              classpathref="classpath" />
      <copy todir="${Weblogicのアプリケーションディレクトリ}">
         <fileset dir=".">
            <include name="EJBの名前.jar" />
         </fileset>
      </copy>

   </target>

wldeployタスクでlibrary属性をtrueにする。


wldeploy Ant タスクのリファレンス
http://edocs.beasys.co.jp/e-docs/wls/docs92/programming/wldeploy.html