I would go ahead and make your code generator a full-blown Maven plugin, as Nicolas assumed initially. I've done this myself a few times and it is pretty simple. Then use the @parameter to specify the location of your resources, and poof, you're done. Unless of course you have a good reason for not doing this.
Wayne On 12/8/07, Kallin Nagelberg <[EMAIL PROTECTED]> wrote: > Thank you, I've forwarded the discussion to the codehaus mailing list to see > what their opinion is on the matter. > > On Dec 8, 2007 3:47 PM, nicolas de loof <[EMAIL PROTECTED]> wrote: > > > "enclosing project's dependencies as classpath" does not mean "enclosing > > project classpath". > > You have acces to all declared dependencies BUT not to the project > > classes/ressources. (this may be a valuale enhancement to the plugin). > > > > Nico. > > > > > > 2007/12/8, Kallin Nagelberg <[EMAIL PROTECTED]>: > > > > > > Thanks for the prompt reply. > > > > > > My code-generator (the java classes anyways) have been packaged as a > > > regular > > > jar artifact. > > > I am using the Maven Exec Plug-In java goal, > > > http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html. > > > It states 'Executes the supplied java class in the current VM with the > > > enclosing project's dependencies as classpath.' That is accurate, as the > > > plugin has no problems finding the classes in the pom's dependencies. > > > However it doesn't seem to include the enclosing POM's resources.. > > > From the sounds of it this is likely an issue with the codehaus plugin > > > more > > > than a core maven issue. I'll pose this question on their mailing list > > > also. > > > > > > Kal. > > > > > > > > > > > > > > > > > > On Dec 8, 2007 2:14 PM, nicolas de loof <[EMAIL PROTECTED]> > > wrote: > > > > > > > Tell me if I understand well : > > > > > > > > your code-generator has been packaged as a Mojo and is used in another > > > > project. It loads some config file from classpath to generate code. > > > > > > > > Maven plugins run in isolated classloaders, they have no acces to the > > > > current project classpath. > > > > > > > > First option (the maven way) is to rework the code generator to use a > > > > parametrized folder to load config files used in generation. You then > > > just > > > > have to set a new @parameter in the Mojo. > > > > > > > > Second option - if changing the legacy code is too complex - is to > > setup > > > a > > > > new URLClassloader with the plugin classloader as parent and add the > > > > project > > > > resources folder. You can the load the generator class using this > > > > classloader and invoke the "generate()" method by reflexion. > > > > > > > > Nico. > > > > > > > > > > > > > > > > > > > > > > > > 2007/12/8, Kallin Nagelberg <[EMAIL PROTECTED]>: > > > > > > > > > > I'm trying to convert the source-generation of a legacy system into > > a > > > > > mavenized project. Basically I need to run a couple of java classes > > > from > > > > > an > > > > > already existing dependency (during the generate-sources phase I > > > assume) > > > > > which should populate my source directories. The problem I'm having > > is > > > > > that > > > > > it seems maven is ignoring my <resource> declarations during the > > > > > generate-sources phase. Is this normal? To run the two java classes > > > > > requried > > > > > for source generation I'm using the exec-maven-plugin and it > > > definitely > > > > > doesn't find my declared resources on it's classpath.. > > > > > > > > > > I've managed to find some hacks around this, like telling the > > > > > maven-resources-plugin to execute the 'resources' goal during > > > > > generate-sources, but that doesn't seem so clean to me, as it's > > > probably > > > > > going to do it again during the generate-resources phase.. > > > > > > > > > > Any ideas? > > > > > > > > > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]