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 8681429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:30:30+00:00 2026-06-12T21:30:30+00:00

The question seems to be obvious, but the implementation is pretty hard for me.

  • 0

The question seems to be obvious, but the implementation is pretty hard for me.

My goal is to write Ant build script to compile some classes that require another classes generated by Annotation Processor.
I have a custom annotations and it’s processor implementation (inherited from AbstractProcessor class).

As I understand I need to:

  1. Compile the Annotation Processor
  2. Run the compiler over some annotated classes to generate the new ones.
  3. Compile the classes that require generated classes

The code (step 1 & 2):


<target name="compileAnnotationProcessor">        
    <javac destdir="${OUTPUT_DIR}"
           debug="true"
           failonerror="true"
           includeantruntime="false"
           classpath="${java.class.path}">
        <src>
            <pathelement path="${PROJECT_DIR}/tools/src"/>
        </src>

        <include name="/path/to/annotation/processor/package/**"/>
    </javac>
</target>

<target name="generateFilesWithAPT" depends="compileAnnotationProcessor">
    <javac destdir="${OUTPUT_DIR}"
           includeantruntime="false"
           listfiles="false"
           fork="true"
           debug="true"
           verbose="true">
        <src>
            <pathelement path="${PROJECT_DIR}/common/src/"/>
        </src>
        <include name="/path/to/files/to/compile/**"/>
        <classpath>
            <pathelement path="${OUTPUT_DIR}"/>
            <pathelement path="${java.class.path}"/>
        </classpath>

        <compilerarg line="-proc:only"/>
        <compilerarg line="-processorpath ${OUTPUT_DIR}/path/to/annotation/processor/package/annProcessorImplement"/>
    </javac>
</target>

Actually, the first task is performing good and compiles the .class file for the Annotation processor implementation. It is stopping at 2nd task.

Ant says: Annotation processing without compilation requested but no processors were found.

What am I doing wrong?
Maybe I should put the annotation processor class in a .jar? Or provide a file name with .class extension as -processorpath argument?
I tried several options but nothing helps..


Notes:

I’m using ant javac task instead of aptone because documentation claims that apt tool as well as com.sun.mirror API is deprecated.
I’ve also looked through this question, but there is no information how to compile the processor in right way.

I’m using:

  • Java 1.6
  • Ant 1.8.2
  • 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-06-12T21:30:31+00:00Added an answer on June 12, 2026 at 9:30 pm

    My usual approach is:

    • pack the annotation together with the annotation processor in its own jar
    • register the annotation processor via META-INF/services in that jar

    Then wherever you have a dependency on your annotations, the annotation processor will be picked up automatically without any additional configuration.

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

Sidebar

Related Questions

This seems like a fairly obvious question, but I haven't been able to think
Sorry if this question seems obvious for everyone, but I am very new to
This seems like an obvious question but there does not appear to be an
Apologies if this has been asked before but it seems an obvious question for
This might sound like an obvious question but I can't seem to find the
This question seems to be asked freqeuently over the internet but I still can't
This question seems to have been asked a lot, but I haven't seen an
The question seems pretty well formulated I have a virtual machine which implements only
Apologies for if the question is obvious but I can't figure out why it
Be forewarned: This question seems way more obvious than it actually is. I'd like

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.