Reputation: 8786
I have a python script that downloads the latest svn build, then converts the project to an aspectj project and adds the necessary libraries , except for the Aspectj Runtime Library. I have my script trying to add the library in to the .classpath
file like so: <classpathentry exported="true" kind="con" path="/Users/rovimacmini/.m2/repository/org/aspectj/aspectjrt/1.8.0/aspectjrt-1.8.0.jar"/>
but I get an error that the aspectjrt.jar isn't in the classpath
. Does anyone know how I can add it via the .classpath
file so that my java build path has the AspectJ Runtime Library in it like so:
Upvotes: 0
Views: 2852
Reputation: 67297
I suggest you manually create an AspectJ project in Eclipse and just look at how Eclipse does it.
.project needs an 'ajbuilder' and an 'ajnature':
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>AspectJ_Project</name>
<comment></comment>
<projects></projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.ajdt.core.ajbuilder</name>
<arguments></arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
.classpath needs a container ("con") classpath entry for the AspectJ runtime:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Update: I also tried replacing the container entry provided by AJDT by a direct reference to a manually installed library in my local file system like this:
<classpathentry kind="lib" path="C:/Program Files/Java/AspectJ/lib/aspectjrt.jar"/>
It works nicely. So in this case it is not con
, but lib
type. In my experience it also is not necessary to set the exported
property, you can just skip that one.
Upvotes: 2