You will have to use the EJB taska from ANT for the supported App server.
http://ant.apache.org/manual/index.htmlLook for EJB tasks under optional tasks.
Alternatively , you may use your DEV environment to create the deployed code for EJB and use the regular JAR task to create the Jar file.
Will update with sample when I get a few minutes.