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

  • Home
  • SEARCH
  • 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 7543407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:25:13+00:00 2026-05-30T08:25:13+00:00

Environnement : Simple Java stand-alone application. AspectJ jar inside. I’ve two projects. The first

  • 0

Environnement : Simple Java stand-alone application. AspectJ jar inside.

I’ve two projects. The first one, say ‘A’ contains a custom method scope annotation and an aspect who is in charge of doing some task when the method is called.

The annotation :

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AccessibleForRole {

    String value() ;

}

The aspect :

public aspect AccessibleListener {

pointcut verifyRole(): 
    (
            call(@AccessibleForRole * *())          
    );

    before() : verifyRole() { // do something
    }
}

I’ve done a jar file with thoses annotations/aspects.

After that, I create a model class in project A. I annotate a method with my annotation, run the program and I see the aspect catching the event and working on.

public class Model {

    @AccessibleForRole("admin")
    public void addUserToApplication(){
        System.out.println("in Model.addUserToApplication.");
    }
}

It works fine….but….
If I create a second project, project ‘B’ using jar ‘A’, and I create new classes, with methods that I annotate (same a Model for example), it seems that nothing special occurs. Nothing is catched.

Is it possible to create, in the future, something that have to be catched with AspectJ from project A jar, without having to recompile ?

Thanks in advance,

  • 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-30T08:25:14+00:00Added an answer on May 30, 2026 at 8:25 am

    Problem resolved.
    Thanks to a Maven plugin : http://mojo.codehaus.org/aspectj-maven-plugin/libraryJars.html

    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    

    I put :

    <aspectLibraries>
        <aspectLibrary>
           <groupId>myGroupId</groupId>
           <artifactId>jarA</artifactId>
        </aspectLibrary>
    </aspectLibraries>
    

    And when building or running, code from project B is correctly intercepted by the aspect define in jarA.

    I hope this will help.

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

Sidebar

Related Questions

I work on a fairly simple but large two-tier application that consists approximately 40
I made a really simple java example with two files: Dog.java contains: package com.greg.dog;
i am developing an simple blackberry application in BlackBerry - Java Plug-in for Eclipse.
I just started programming in Java, and I need to get a simple application
I have to integrate a Java applet into a simple asp.net 2.0 control. This
I've been integrating simple java modules into the MATLAB environment on Windows with some
I created a simple smoketest for a portal running java/tomcat/jahia (cms) fronted by cache
We have a Java web application and we'd like to set up some basic
I am writing simple webapp in Java (for educational purpuses only) which allows admin
Part of our java application needs to run javascript that is written by non-developers.

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.