I recently posted a question on the maven user mailing list about an issue I encountered while using the codehaus exec plugin. My response has led me to believe that the issue has more to do with the plugin than with maven.
Here is the transcript to give some context. On Dec 8, 2007 3:43 PM, Kallin Nagelberg <[EMAIL PROTECTED]> wrote: > 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? > > > > > > >
