mraible wrote:

Now I need
to add the resources and testResources paths (src/main/resources and
src/test/resources). Is it possible to do that with a similar
annotation-like syntax?

I still wonder why you want to access the test stuff but use

 @phase process-sources
 @requiresDependencyResolution compile
 @execute phase="compile"

This does not fit very well together: The suggested phase "process-sources"
is run before "generate-test-resources" so your plugin will miss generated
resources. Likewise, executing only the phase "compile" as specified by your
@execute annotation will not generate test stuff.

Final note: The annotation "@execute" will fork the build. If your plugin is
not primarily intended to be invoked from the CLI, you could consider to
drop the annotation and save yourself some build time.

Anyway, as for the resources: Once the phases "process-resouces" and
"process-test-resources" have run (more precisely the
maven-resources-plugin), the resource files have been copied and filtered
over to "target/classes" and "target/test-classes" respectively. So, the
usual way to load the resources from the class path is just to run in/after
these phases, e.g. use

 @phase process-test-resources

If you really need to break with the semantics of the build lifecycle, you
need to push the raw (e.g. unfiltered) resources manually into your class
loader. To access the resources specified in the POM, you could use:

 /**
  * @parameter default-value="${project.resources}"
  * @readonly
  */
 List resources;

 /**
  * @parameter default-value="${project.testResources}"
  * @readonly
  */
 List testResources;

Adding their base directories to the class path should do.


Benjamin


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to