我在使用ant构建此应用程序时遇到了麻烦。
所以,这是我的目录结构。我所有的文件和 aspectj jar文件。
AspectProject/
├── AddCheatKey.aj
├── AddSound.aj
├── AddStrategy.aj
├── bin
│ └── aspectjrt-1.8.9.jar
├── build.xml
├── RandomStrategy.java
├── SmartStrategy.java
├── sounds
│ ├── cheering.wav
│ ├── cheer.ogg
│ ├── chip1.wav
│ ├── chip2.wav
│ └── wood_chip.wav
└── Strategy.java
当我使用命令: ant 或 ant -f build.xml 时,出现错误。说 aspectj jar文件不存在。即使它在目录树中!
BUILD FAILED
/home/user/Desktop/AspectJ-ConnectFour/build.xml:10: **The archive aspectjrt-1.8.9.jar doesn't exist**
<?xml version="1.0" encoding="UTF-8"?>
<project name="c4" basedir="." default="jar">
<property name="ajrt.dir" value="\"/>
<property name="ajrt.jar" value="aspectjrt-1.8.9.jar" />
<property name="class.dir" value="bin"/>
<property name="jar.file" value="${ant.project.name}.jar"/>
<property name="main-class" value="c4.base.C4Dialog"/>
<target name="jar">
<jar destfile="${jar.file}" basedir="${class.dir}"> <!-- LINE 10 -->
<zipfileset src="${ajrt.dir}/${ajrt.jar}" excludes="Meta-INF/*"/>
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
</project>