Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6600627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:38:57+00:00 2026-05-25T18:38:57+00:00

I think about using AspectJ in an existing project. I have several pure Java

  • 0

I think about using AspectJ in an existing project.

I have several pure Java Eclipse projects and I like to create an AOP project.

I’m not quite sure about when ajc is needed and when optional. We use Ant (with javac) as our main build and I would like to avoid changing the build.

Is the following possible:

I have a AspectJ enabled Eclipse and create my aspect project. I create a jar from this and include this jar with the aspectj jar in the normal eclipse workspace with the other projects.
The build includes my aspect jar and the aspectj jar as dependency jars with javac.

Is this enough for working with the aspects ?
Or do every project of the application needs to be compiled with ajc ?

The main goal is to keep the current structure of Eclipse setup and build environment as as much as possible as it is now.

Or is this only possible with the annotation style ? (if so can someone link me some information about the weaver and how to do this at runtime ?)

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:38:58+00:00Added an answer on May 25, 2026 at 6:38 pm

    If you want to weave your aspect into your codebase, you must use AJC. If you only use javac, even with the annotation, your code won’t be weaved by your aspects.

    That being said, you don’t have to add a lot to your ant build.

    something like that should do the job:

    <path id="ajclasspath">
        <path refid="classpath"/>
        <pathelement location="${scm.home}/ant_libs/aspectjrt.jar"/>
    </path>
    <iajc inpath="${classes.dir}" destDir="${classes.dir}" fork="true" maxmem="${aspectj.maxmem}">
        <argfiles refid="aspectj.argfiles.path"/>
        <classpath refid="ajclasspath"/>
    </iajc>
    

    In fact, you just build like normal and you add a step with the iajc taking your output dir of the javac compile as the inpath and you put the result in the same directory.

    You can also take a jar as input to iajc and produce a jar with all your stuff weaved inside.

    Edit: Or you can use runtime weaving, if your app is a web application, it is not too bad. If not, i do not recommand runtime weaving, since each time you will start your app, it might be a lot longer to start. I don’t have a lot of experience with runtime weaving, but you can check it out. I know you need a aop.xml to define your aspects.

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like know what people think about using RAISERROR in stored procedures to pass
One thing I have continually found very confusing about using an object database like
What do you think about the concept of using ORO instead of traditional Garbage
What do you guys think about this for a generic singleton? using System; using
I think this is a moderately neophyte question. I've been using NHibernate/FluentNHibernate for about
How do you think about data access code like this: public void AddCusotmer(Cusotmer customer)
I'd like to ask about using frames in a modern intranet-only web application. Of
Do you have any advice as how to setup a Dropbox like service using
What do you think about using private static methods ? Personally, I prefer using
I'm curious to know, what people here think about using org.apache.commons.lang.builder EqualsBuilder / HashCodeBuilder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.