RE: Generating resource base on compilation result

2010-09-03 Thread Adrian Shum


It turns out that I have another plugin facing a similar problem:

I want to compile the java source first, and generate some resources 
to be included in final JAR base on the compiled class.

I can only put that on or after process-classes phase. However, from
the experience stated in the original mail, adding project resources
will not work in such case.

What is the 'correct' way to put such generated resources into final
JAR?
Should I simply manually copy the result resources to
${project.build.outputDirectory}?
Is it the suggested way?

Thanks

--
Best Regards,
AdRiAN ShUM


-Original Message-
From: Adrian Shum 
Sent: Wednesday, August 04, 2010 10:29 AM
To: 'Maven Users List'
Subject: RE: Generating resource base on compilation result


Hi Jesse,

Breaking out another dummy project will be my last resort, coz I also
want to make this mojo works for simple projects.

Seems the "difficult if not imposssible" way is my only way to go  :(

Maybe what if I change my question to another way:
Is there any way to add resource to resulting jar, apart from
project.addResource() before the process-resources phase?

--
Best Regards,
AdRiAN ShUM


-Original Message-
From: Jesse Farinacci [mailto:jie...@gmail.com] 
Sent: Tuesday, August 03, 2010 8:09 PM
To: Maven Users List
Subject: Re: Generating resource base on compilation result


Hi AdRiAN,

On Tue, Aug 3, 2010 at 6:53 AM, Adrian Shum  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-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



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.


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



RE: Generating resource base on compilation result

2010-08-03 Thread Adrian Shum
Hi Jesse,

Breaking out another dummy project will be my last resort, coz I also
want to make this
mojo works for simple projects.

Seems the "difficult if not imposssible" way is my only way to go  :(

Maybe what if I change my question to another way:
Is there any way to add resource to resulting jar, apart from
project.addResource() before
the process-resources phase?

--
Best Regards,
AdRiAN ShUM


-Original Message-
From: Jesse Farinacci [mailto:jie...@gmail.com] 
Sent: Tuesday, August 03, 2010 8:09 PM
To: Maven Users List
Subject: Re: Generating resource base on compilation result


Hi AdRiAN,

On Tue, Aug 3, 2010 at 6:53 AM, Adrian Shum  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-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



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.


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



Re: Generating resource base on compilation result

2010-08-03 Thread Jesse Farinacci
Hi AdRiAN,

On Tue, Aug 3, 2010 at 6:53 AM, Adrian Shum  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-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org