Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to run compile time weave with ant? Simple case.

Working example:

--- C.java ---
public class C {}
---

Run: ajc C.java -outjar xxx.jar

--- X.aj -- (in aspects subdir)
public aspect X {
before():staticinitialization(C*) {}
}
---


--- build.xml ---
<project default="build">
 <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
     <classpath>
       <pathelement path="c:/aspectj163-dev/lib/aspectjtools.jar"/>
     </classpath>
 </taskdef>

  <target name="build">
    <iajc srcdir="aspects" inpath="xxx.jar" classpath="yyy.jar;c:/aspectj163-dev/lib/aspectjrt.jar" outjar="xxx_delta.jar" showWeaveInfo="true">
    </iajc>

  </target>
</project>
---

Run: ant
Buildfile: build.xml

build:
     [iajc] weaveinfo Join point 'staticinitialization(void C.<clinit>())' in Type 'C' (C.java) advised by before advice from 'X' (X.aj:2)

BUILD SUCCESSFUL

------------------


>      [iajc] C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar:0::0 this affected type is not exposed to the weaver: com.sun.jbi.framework.ServiceUnit
> [Xlint:typeNotExposedToWeaver]
>
> What does it mean?

It means in order for the weaver to do what you asked, it needed to weave ServiceUnit and because you only gave it to the compiler on the classpath rather than something it could operate upon (via the inpath) then it could not weave it because it couldn't see it.

cheers,
Andy.

2008/10/17 Jason Weinstein <Jason.Weinstein@xxxxxxx>
I have an aspect

public aspect FilterAspect {

in file FilterAspect.aj

How do i run iajc "ant" task to weave jar xxx.jar that depends on jar yyy.jar and place into file xxx_delta.jar

I know how to do LTW but can't get compile time weave to work.


In my attempts i saw this

     [iajc] warning at (no source information available)
     [iajc] C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar:0::0 this affected type is not exposed to the weaver: com.sun.jbi.framework.ServiceUnitFramework [Xlint:typeNotExposedToWeaver]
     [iajc] warning at (no source information available)
     [iajc] C:\workspace\new\EnterpriseManager\gui\esbConsole\lib\jbi\jbi_rt.jar:0::0 this affected type is not exposed to the weaver: com.sun.jbi.framework.ServiceUnit [Xlint:typeNotExposedToWeaver]

What does it mean?


I'd like to do something as simple as

<iajc inJar="xxx.jar" classpath="yyy.jar;aspectrt.jar" aspect="FilterAspect.aj" outJar="xxx_delta.jar"/>


I have to ask why is this so hard? I don't get all the options. A few more examples would be awsome.


Thanks much.


Jason Weinstein wrote:
Fri Oct 17 11:15:58 PDT 2008 info AspectJ Weaver Version 1.6.1 built on Thursday Jul 3, 2008 at 18:35:41 GMT
Fri Oct 17 11:15:58 PDT 2008 info register classloader java.net.URLClassLoader@c260c5
Fri Oct 17 11:15:58 PDT 2008 info using configuration file:/C:/JavaCAPS6/appserver/domains/domain1/lib/aopjbi.jar!/META-INF/aop.xml
Fri Oct 17 11:15:58 PDT 2008 info register aspect com.sun.esb.console.jbi.aspects.FilterAspect
Fri Oct 17 11:15:59 PDT 2008 debug weaving 'com.sun.soabi.capsverifier.AppVerifierLifeCycleListener'
Fri Oct 17 11:15:59 PDT 2008 error can't determine modifiers of missing type com.sun.jbi.framework.ServiceUnitFramework
when processing type mungers com.sun.soabi.capsverifier.AppVerifierLifeCycleListener
when processing type mungers
when weaving
 [Xlint:cantFindType]
Fri Oct 17 11:15:59 PDT 2008 error can't determine modifiers of missing type com.sun.jbi.framework.ServiceUnit
when processing type mungers com.sun.soabi.capsverifier.AppVerifierLifeCycleListener
when processing type mungers
when weaving
 [Xlint:cantFindType]


Assuming this is a classloading issue, how does one write an aspect using LTW where the aspect is brought into memory before the actual impl jars are?

I had been intercepting objects in the jar file containing com.sun.jbi.framework with other pointcuts but hadn't been referencing specific classes before.

Now that i have to reference specific classes it is no longer working.


import com.sun.jbi.framework.ServiceUnit;
import com.sun.jbi.framework.ServiceUnitFramework;

public aspect FilterAspect {
...
    public pointcut startServiceUnitJoinPoint(
        ServiceUnitFramework framework,
        Component component,
        ServiceUnitManager manager,
        ServiceUnit unit) :
       
        withinFramework() &&       
        execution(private void startServiceUnit(Component, ServiceUnitManager, ServiceUnit)) &&
        this(framework) &&
        args(component, manager, unit);


Can i change ServiceUnit and ServiceUnitFramework above to Object or something more general so i don't reference them at the time the aspect is loaded? What is best practice here? Note this is occuring in an app server.


_______________________________________________ aspectj-users mailing list aspectj-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top