I am using Ant to build, I'm getting these errors:
Buildfile: ...\build.xml
clean:
[delete] Deleting directory D:\IdanWorkSpace\ECMSEJB\classes
ejb.compile:
[mkdir] Created dir: D:\IdanWorkSpace\ECMSEJB\classes
[javac] Compiling 26 source files to D:\IdanWorkSpace\ECMSEJB\classes
[javac] ...\src\com\mirs\ecms\mdb\ECMSDispatcherMDB.java:28: illegal start of expression
[javac] })
[javac] ^
[javac] ...\src\com\mirs\ecms\mdb\ECMSErrorHandlerMDB.java:25: illegal start of expression
[javac] }
[javac] ^
[javac] 2 errors
The java class: ECMSDispatcherMDB.java
@MessageDriven( activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination",
propertyValue = Constants.CALLS_QUEUE_LOOKUP),
@ActivationConfigProperty(propertyName = "maxSession",
propertyValue = "50"),
@ActivationConfigProperty(propertyName = "transactionTimeout",
propertyValue = "30000"),
} )
public class ECMSDispatcherMDB implements MessageListener
{
Logger logger = Logger.getLogger("ecms.log");
private static final String TAG = "ECMSDispatcherMdb";
ConnectorManager connectorManager = ConnectorManager.getInstance();
@EJB
private ECMSEntityManagerDaoLocal dao;
...
The java class: ECMSErrorHandlerMDB.java
@MessageDriven( activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination",
propertyValue = Constants.ERORR_QUEUE_LOOKUP),
@ActivationConfigProperty(propertyName = "maxSession",
propertyValue = "50"),
} )
public class ECMSErrorHandlerMDB implements MessageListener
{
Logger logger = Logger.getLogger("ecms.log");
private static final String TAG = "ECMSErrorHandlerMDB";
ConnectorManager connectorManager = ConnectorManager.getInstance();
@EJB
private ECMSEntityManagerDaoLocal dao;
...
And here's the Ant buildfile build.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="ECMS Ant" basedir="." default="create ear">
<property file="build.properties" />
<path id="base.path">
<fileset dir="${project.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${project.lib2}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="clean" description="Delete all generated files">
<delete dir="${ejb.classes.dir}" />
<delete dir="${web.classes.dir}" />
<delete dir="${deploy.dir}" />
</target>
<target name="ejb.compile" description="Compiles the Task" depends="clean">
<mkdir dir="${ejb.classes.dir}" />
<javac srcdir="${ejb.src.dir}" destdir="${ejb.classes.dir}">
<classpath>
<path refid="base.path" />
</classpath>
</javac>
</target>
<target name="web.compile" description="Compiles the Task" depends="ejb.compile">
<mkdir dir="${web.classes.dir}" />
<javac srcdir="${web.src.dir}" destdir="${web.classes.dir}">
<classpath>
<path refid="base.path" />
<path refid="${ejb.classes.dir}" />
</classpath>
</javac>
</target>
<target name="create jar" description="create jar" depends="ejb.compile">
<!-- new jars-->
<jar destfile="${deploy.dir}/ecmsejb.jar">
<fileset dir="${ejb.classes.dir}">
<!-- include the folders: facade -->
</fileset>
<metainf dir="${ejb.src.dir}/META-INF" >
<!--exclude name="*application.xml" /-->
</metainf>
</jar>
</target>
<target name="create war" description="Creates war file" depends="web.compile">
<war warfile="${deploy.dir}/ecmsweb.war"
webxml="${web.project.root}/WebRoot/WEB-INF/web.xml">
<webinf dir="${web.project.root}/WebRoot/WEB-INF/" />
<classes dir="${web.classes.dir}">
<!-- include the folders: webServices -->
</classes>
<classes dir="${web.project.root}/WebRoot/WEB-INF/classes" />
</war>
<!--delete dir="${project.root}/WebRoot/WEB-INF/classes/META-INF" /-->
</target>
<target name="create ear" description="create ear" depends="create war">
<ear destfile="${deploy.dir}/ecms.ear"
appxml="${project.root}/META-INF/application.xml">
<fileset dir="${deploy.dir}" />
<metainf dir="${project.root}/META-INF" />
</ear>
</target>
</project>
The errors are related to the Annotations I am using. What do I need to do to fix this Ant build to compile my class Annotations?
It looks like you have trailing commas in your annotation arrays, which javac views as illegal - unlike in 'proper' arrays. (There is a bug in eclipse that doesn't report these as such.)
Remove the trailing commas, e.g.:
@MessageDriven(activationConfig =
{ @ActivationConfigProperty( ... ),
@ActivationConfigProperty( ... ),
@ActivationConfigProperty( ... ),
@ActivationConfigProperty( ... ) // no comma here
} );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With