AspectJ 6 +编译应用程序时 Netbeans 7.0 错误
我正在尝试将 AspectJ 的最新版本与 netbeans 7.0 一起使用。我所做的基本上就是下载 .jar 文件并将其解压。在此处编辑 build.xml 后,它看起来如何:
<?xml version="1.0" encoding="UTF-8"?>
<project name="TestApp" default="default" basedir=".">
<description>Builds, tests, and runs the project TestApp.</description>
<import file="nbproject/build-impl.xml"/>
<taskdef classpath="C:/Users/lorddoskias/Desktop/aspectj-1.6.11/lib/aspectjtools.jar"
resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"/>
<target name="aspectj">
<echo level="info">--- aspectj (start) ---</echo>
<iajc destDir="${build.classes.dir}">
<inpath>
<pathelement location="C:/Users/lorddoskias/Desktop/aspectj-1.6.11/lib/aspectjrt.jar"/>
<pathelement location="${build.classes.dir}" />
</inpath>
<sourceroots>
<pathelement location="${src.dir}"/>
</sourceroots>
<classpath>
<pathelement location="${javac.classpath}"/>
<pathelement location="${j2ee.platform.classpath}"/>
</classpath>
</iajc>
<echo level="info">LORDDOSKIAS BRUTAL TEST ---</echo>
</target>
<target name="-post-compile" depends="aspectj"></target>
</project>
在我尝试编译我的项目后,我得到的是:
The type Map is not generic; it cannot be parameterized with arguments <String, String>
error at public Map<String, String> getParametersForStep(int workflowId, int workstepPos) {
Syntax error, parameterized types are only available if source level is 5.0
error at Map<String, String> hMap = new HashMap<String, String>();
还有更多类似的内容。
我的 java 版本是:
1.6.0_26 SE
是否有关于如何将 AspectJ 与 Netbeans 7.0 一起使用的教程。这不会用于 EE 应用程序,而是用于简单的基于控制台的 SE 应用程序。另外我没有安装JavaEE。
I'm trying to use AspectJ's latest version with netbeans 7.0. What I did was basically download the .jar file and extract it. After editing build.xml here how it looks:
<?xml version="1.0" encoding="UTF-8"?>
<project name="TestApp" default="default" basedir=".">
<description>Builds, tests, and runs the project TestApp.</description>
<import file="nbproject/build-impl.xml"/>
<taskdef classpath="C:/Users/lorddoskias/Desktop/aspectj-1.6.11/lib/aspectjtools.jar"
resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"/>
<target name="aspectj">
<echo level="info">--- aspectj (start) ---</echo>
<iajc destDir="${build.classes.dir}">
<inpath>
<pathelement location="C:/Users/lorddoskias/Desktop/aspectj-1.6.11/lib/aspectjrt.jar"/>
<pathelement location="${build.classes.dir}" />
</inpath>
<sourceroots>
<pathelement location="${src.dir}"/>
</sourceroots>
<classpath>
<pathelement location="${javac.classpath}"/>
<pathelement location="${j2ee.platform.classpath}"/>
</classpath>
</iajc>
<echo level="info">LORDDOSKIAS BRUTAL TEST ---</echo>
</target>
<target name="-post-compile" depends="aspectj"></target>
</project>
After I try to compile my project here is what I get:
The type Map is not generic; it cannot be parameterized with arguments <String, String>
error at public Map<String, String> getParametersForStep(int workflowId, int workstepPos) {
Syntax error, parameterized types are only available if source level is 5.0
error at Map<String, String> hMap = new HashMap<String, String>();
And a lot more like those.
My java version is:
1.6.0_26 SE
Is there somewhere a tutorial as to how to use AspectJ with Netbeans 7.0. This won't be used for an EE application but for a simple console-based SE application. Also I don't have JavaEE installed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题不在于aspectj;您可能正在尝试在 1.4 或更早版本的项目上编译 Java5+ 代码。
在 Netbeans 中,右键单击项目名称并将源/二进制格式更改为 JDK 1.5 或 1.6。从这一步开始,您可以继续解决其他问题。
The problem lies not within aspectj; you're probably trying to compile Java5+ code on a 1.4 or older project.
In Netbeans, right click the name of the project and change source/binary format to JDK 1.5 or 1.6. From that step you can go on solving other issues.