• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I process compile time annotations from a Mojo

 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have couple of modules that have the following

a) A bunch of XML files
b) A custom compile time Annotation on several java files
c) A bunch of other resources that contain snippets of the final artifact.

All these need to be processed to create a single artifact. So, right now what we have done is
a) Implement a Mojo that converts the XML to a snippet of the artifact
b) Implement an Annotation processor that generates snippets of the artifact by processing the compile time annotation
c) Implement another mojo that merges the 3 snippets together into one artifact

We have to run this process twice because there are minor differrences in the artifact that is used for unit testing vs the artifact used for production

Everything works fine, but the problem is my pom.xml is very big. I have 2 of my own plugins and maven processor plugin. Both of my plugins have 2 executions, one for production, one for test. Also, the final artifact is being created by 3 seperate plugins, fixing problems is kind of a pain

I wanted to merge all 3 functions into one MOJO. I can merge my 2 Mojos easily, but how do I process compile time annotations from my Mojo?. Is there a code sample available somewhere?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Annotation processor is just some Java code, right? Couldn't you invoke that code directly from your mojo? If nothing else, you could always directly call the main() method of the main class. Though most likely that just does some processing of the arguments and then calls another class - it is that class that you really want to call.
 
Our first order of business must be this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic