我正在使用Ant进行构建,遇到了以下错误:
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
Java类: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;
...
Java类: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;
...
这里是Ant的构建文件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>
这些错误与我使用的注释相关。 我需要做什么来修复这个Ant构建以编译我的类注释?
javac -version
命令时,如果你看到的版本是 Java1.4 或更低,则需要将 ANT 的编译级别更改为你所拥有的 Java 版本。如果你的 Java 版本是 5 或以上,则需要相应地更改编译级别。 - Nishant