Hi guys,

Ive been trying to invoke ejbdoclet without build.xml as follows:

public static void main(String[] args) {

       

                Project project = new Project();

                project.init();

                project.fireBuildStarted();

               

                EjbDocletTask ejbDocletTask = new EjbDocletTask();

                ejbDocletTask.init();

               

                ejbDocletTask.setProject(project);

                ejbDocletTask.setTaskName("EjbDoclet");

                ejbDocletTask.setDestDir(new File("D:\\ejb"));

               

                EjbDocletTask.EjbSpecVersion ejbSpecVersion = new EjbDocletTask.EjbSpecVersion();

                ejbSpecVersion.setValue(EjbDocletTask.EjbSpecVersion.EJB_2_0);         

                ejbDocletTask.setEjbSpec(ejbSpecVersion);

               

                ejbDocletTask.setForce(true);

                ejbDocletTask.setVerbose(true);

               

                FileSet fileSet = new FileSet();

                fileSet.setDir(new File("D:\\ejbsrc"));

                fileSet.setIncludes("**/ejb/*.java");

                ejbDocletTask.addFileset(fileSet);

               

                RemoteInterfaceSubTask remoteInterfaceSubTask = new RemoteInterfaceSubTask();

                remoteInterfaceSubTask.setSubTaskName("remoteinterface");

                ejbDocletTask.addSubTask(remoteInterfaceSubTask);

                LocalInterfaceSubTask localInterfaceSubTask = new LocalInterfaceSubTask();

                localInterfaceSubTask.setSubTaskName("localinterface");

                ejbDocletTask.addSubTask(localInterfaceSubTask);

               

                HomeInterfaceSubTask homeInterfaceSubTask = new HomeInterfaceSubTask();

                homeInterfaceSubTask.setSubTaskName("homeinterface");

                ejbDocletTask.addSubTask(homeInterfaceSubTask);

               

                LocalHomeInterfaceSubTask localHomeInterfaceSubTask = new LocalHomeInterfaceSubTask();

                localHomeInterfaceSubTask.setSubTaskName("localhomeinterface");

                ejbDocletTask.addSubTask(localHomeInterfaceSubTask);

               

                DaoSubTask daoSubTask = new DaoSubTask();

                daoSubTask.setSubTaskName("dao");

                ejbDocletTask.addSubTask(daoSubTask);

               

                SessionSubTask sessionSubTask = new SessionSubTask();

                sessionSubTask.setSubTaskName("session");

                ejbDocletTask.addSubTask(sessionSubTask);

               

                EjbDotXmlSubTask ejbDotXmlSubTask = new EjbDotXmlSubTask();

                ejbDotXmlSubTask.setSubTaskName("deploymentdescriptor");

                ejbDotXmlSubTask.setDestDir(new File("D:\\ejb"));

                ejbDotXmlSubTask.setValidateXML(true);

                ejbDocletTask.addSubTask(ejbDotXmlSubTask);

                       

                WebLogicSubTask webLogicSubTask = new WebLogicSubTask();

                webLogicSubTask.setSubTaskName("weblogic");

                WebLogicSubTask.Version version = new WebLogicSubTask.Version();

                version.setValue("6.1");

                webLogicSubTask.setVersion(version);

                webLogicSubTask.setXmlencoding("UTF-8");

                webLogicSubTask.setDestDir(new File("D:\\ejb"));

                webLogicSubTask.setValidateXML(false);

                webLogicSubTask.setDatasource("mojJNDI01");

                webLogicSubTask.setPersistence("weblogic");

                ejbDocletTask.addSubTask(webLogicSubTask);

               

                ejbDocletTask.execute();

                project.fireBuildFinished(null);

        }

Problems:

1.      the generated ejb-jar.xml is not the same as the one generated through build.xml.

2.      without giving names to subtasks, the code wont run.

3.      without adding the dao subtask, the code wont run

Sincerely,

Don Han()

China Delivery Center, Accenture

Email: dong.han@accenture.com

MSN: plestoon@hotmail.com

Tel: 0411-82147800-6465