You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adrian Shum <tc...@taifook.com> on 2010/08/03 12:53:51 UTC

Generating resource base on compilation result

Hi all,
 
I am trying to develop a plugin which will generate certain resources
base on compiled classes and dependencies.
(in fact, generating persistence.xml for all classes annotated @Entity,
I cannot use apt to do this because I want to include all dependencies
in the generation)
 
However, if I bind the mojo to process-classes (as I want to include
compilation result of current project in the generation process), even
I have added the output resource directory to project in my mojo, that's
not reflected in the final JAR.
 
It is fine if I bind it to process-source, but I will not be able to
include
classes of current project.
 
Is there any suggestion for me?
 
I am using maven 2.2.1
 
--
Best Regards,
AdRiAN ShUM
 


This email is confidential. If you are not the intended recipient, please delete it from your system and notify the sender immediately. Any unauthorized use, disclosure, dissemination or copying of this email is prohibited. Taifook Securities Group, its group companies and their content providers ("Parties") shall not be responsible for the accuracy or completeness of this email or its attachment, if any, which could contain virus, be corrupted, destroyed, incomplete, intercepted, lost or arrive late.   The Parties do not accept liability for any damage caused by this email.



Re: Generating resource base on compilation result

Posted by Jesse Farinacci <ji...@gmail.com>.
Hi AdRiAN,

On Tue, Aug 3, 2010 at 6:53 AM, Adrian Shum <tc...@taifook.com> wrote:
>
> I am trying to develop a plugin which will generate certain resources
> base on compiled classes and dependencies.

Cool.

> Is there any suggestion for me?

You could quite easily solve this if you just create another module
which depends on your domain object module. Then run your classpath
scanning for @Entity / @Embedded, etc, and output a persistence.xml.
Trying to do this process in the same module without using APT *and*
using the compiled classes will be difficult if not impossible. If you
wanted to simply examine the source code and the dependency classpath,
maybe it would work. But since you're oddly requiring compiled code,
I'm fairly sure it will not.

Just break it into separate modules and all will be fine. Or use APT.

-Jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org