关于xdoclet中生成EJB部署描述符的问题(100分)

  • 主题发起人 主题发起人 蓝色虾
  • 开始时间 开始时间

蓝色虾

Unregistered / Unconfirmed
GUEST, unregistred user!
于eclipse2.1中做ejb范例,使用ant+xdoclet生成ejb-jar.xml文件
源文件存放于src/examples中,编译后的文件存于classes中。
我的build.xml文件编写如下所示:
<project name="BuildDes" default="builddes" basedir=".">
<description>
simple example build file
</description>
<property name="src.dir" location="src/examples"/>
<property name="metainf.dir" location="META-INF"/>
<property name="lib.dir" location="lib"/>

<target name="init">
<mkdir dir="${metainf.dir}"/>
<path id="project.class.path">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="ejbdoclet"
classname="xdoclet.modules.ejb.EjbDocletTask"
classpathref="project.class.path"/>
</target>

<target name="builddes" description="generat the distribution" depends="init">
<tstamp>
<format property="TODAY" pattern="d-MM-yy"/>
</tstamp>

<ejbdoclet
destdir="${metainf.dir}"
excludedtags="@version,@author"
ejbspec="2.0">

<fileset dir="${src.dir}">
<include name="**/*Remote.java"/>
</fileset>

<remoteinterface pattern="{0}Remote"/>

<localinterface pattern="{0}"/>
<homeinterface />

<localhomeinterface/>
<deploymentdescriptor destdir="${metainf.dir}"
description="CMP with Ant"
displayname="CMP" />

</ejbdoclet>
</target>

<target name="clean" description="clean up"/>
</project>
运行正常:
buildfile: D:/eclipse/workspace/MyEJB/build.xml
init:
[mkdir] Created dir: D:/eclipse/workspace/MyEJB/META-INF

init:
builddes:
[ejbdoclet] Running <remoteinterface/>
[ejbdoclet] Running <localinterface/>
[ejbdoclet] Running <homeinterface/>
[ejbdoclet] Running <localhomeinterface/>
[ejbdoclet] Running <deploymentdescriptor/>
[ejbdoclet] Generating EJB deployment descriptor (ejb-jar.xml).
clean:
BUILD SUCCESSFUL
Total time: 5 seconds
但是生成的ejb-jar.xml文件中只有一些注释信息:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar >
<description><![CDATA[CMP with Ant]]></description>
<display-name>CMP</display-name>
<enterprise-beans>
<!-- Session Beans -->
<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor >
<!--
To add additional assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar>
我的example目录下的AccountRemote.java中的紧接着import的注释部分如下所示:
/**
* @ejb.bean
* name="AccountBean"
* type="BMP"
* jndi-name="AccountHome"
* local-jndi-name="AccountLocalHome"
* reentrant="false"
*
* @ejb.pk
* class="examples.AccountPK"
*
* @ejb.interface
* remote-class="examples.Account"
* local-class="examples.AccountLocal"
*
* @ejb.home
* remote-class="examples.AccountHome"
* local-class="examples.AccountLocalHome"
*
* @ejb.resource-ref
* res-ref-name="jdbc/ejbPool"
* res-type="javax.sql.DataSource"
* res-auth="Container"
*
* @ejb.env-entry name="DataSourceName"
* value="java:/mysql"
*/
问题1:为何我的ejb-jar文件中不能产生正确的部署信息呢?是由于我的AccountRemote.java没有
在文件集中吗?
问题2:<remoteinterface pattern="{0}Remote"/>中的{0}是表示目前可用结果集中
含有Remote的文件吗?
 
我查看了相关文档,仍然没能够正确生成部署文件,所以求教于各位大虾。
 
后退
顶部