Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » aspectj + ant
aspectj + ant [message #690959] Thu, 30 June 2011 13:21 Go to next message
moha  is currently offline moha Friend
Messages: 43
Registered: March 2011
Member
Hi,

I generate an aspect (with annotation) in a java project and i compile it with ant using the following code :

<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
<classpath>
<pathelement location="lib/aspectjtools.jar"/>
</classpath>
</taskdef>
<target name="compile">
<mkdir dir="${buildfolder}"/>
<property name="ajc"
value="org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter"/>

<javac srcdir="src" destdir="${build}" classpathref="lib.classpath">
<compilerarg compiler="${ajc}" />
</javac>
</target>


the lib.classpath ~ the folder lib
and in the folder "lib" i put aspectjtools.jar ,aspectjrt.jar

when i launch the target i get myAspect.class but without aspectj informations like

public static EntryAspect aspectOf()
{
if(ajc$perSingletonInstance == null)
{
throw new NoAspectBoundException("aspects.EntryAspect", ajc$initFailureCause);
} else
{
return ajc$perSingletonInstance;
}
}


any idea ?


wich compiler can i use javac or iajc or ajc ????

how can i compile aspectj plugins using ant task ????


thanks in advance .
Re: aspectj + ant [message #691082 is a reply to message #690959] Thu, 30 June 2011 16:44 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
iajc is the best ant task to be using for compiling AspectJ code in ant. See the docs here:
http://www.eclipse.org/aspectj/doc/next/devguide/antTasks-iajc.html

What do you mean by AspectJ plugins? Eclipse plugins?
Re: aspectj + ant [message #691335 is a reply to message #691082] Fri, 01 July 2011 08:58 Go to previous messageGo to next message
moha  is currently offline moha Friend
Messages: 43
Registered: March 2011
Member
Hi Andrew,

I mean by Aspectj plugins : plugins eclipse wich contains aspects (aspect with

annotation) .


when i use iajc compiler in order to compile my aspect using ant

<iajc sourceroots="src/aspects" classpathref="aspect.classpath" source="1.5" target="1.5" />


i get this error :

The method getVersion() is undefined for the type Bundle.

because i have in my aspect the instructions :

org.osgi.framework.Bundle bundle = protectionDomain.getBundle();
org.osgi.framework.Version = bundle .getVersion();


i add the org.eclipse.osgi_3.6.1.R36x_v20100806.jar plugin wich contains the

org.osgi.framework.Version class but i always get the same compilation error.

it is a iajc problem ? (i get the same error using javac compiler!!!!!)

any idea ?

thanks in advance.


Re: aspectj + ant [message #691673 is a reply to message #691335] Sat, 02 July 2011 02:25 Go to previous message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
I am guessing that the problem happens because you are not properly adding the osgi bundle to the compile task in your ant file. In the ant file snippet above, I see no reference to that classpath element.

Underneath

<pathelement location="lib/aspectjtools.jar"/>


You will need to add something like:

<pathelement location="path_to_eclipse/plugins/org.eclipse.osgi_3.6.1.R36x_v20100806.jar"/>
Previous Topic:Update Site for Old Versions
Next Topic:Pointcut with annotations
Goto Forum:
  


Current Time: Fri Dec 15 14:18:29 GMT 2017

Powered by FUDForum. Page generated in 0.01494 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software