2009/2/9 Benjamin Bentmann <[email protected]>:
> Olivier THIERRY wrote:
>
>> This plugin should create a file referred by "targetFile" property by
>> reading and merging files referred by "sourceFiles" property. Source
>> files are in Maven project dependencies.
>> So I need to get an input stream on these source files, but I can't
>> find a way to find these files. I tried with getResourceAsStream but
>> it doesn't work.
>
> You could get the (runtime) class path of the current project via a mojo
> parameter like this:
>
>  /**
>   * @parameter default-value="${project.runtimeClasspathElements}"
>   * @readonly
>   */
>  private List<String> runtimeClassPath;
>
> in combination with the mojo annotation @requiresDependencyResolution. From
> the class path, you can populate a URLClassLoader and call
> getResourceAsStream() on this.
>
> Given it's your first plugin, I suggest you have a look at the resources
> listed at the end of this mail that could be of help. Also, spying out the
> source code of other/related plugins at Apache [3] or Codehaus [4] could
> provide some ideas on how to solve certain plugin jobs.
>
>
> Benjamin
>
>
> [0] http://maven.apache.org/plugin-developers/index.html
> [1] http://maven.apache.org/guides/mini/guide-maven-classloading.html
> [2] http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
> [3] http://svn.eu.apache.org/repos/asf/maven/plugins/trunk/
> [4] http://svn.codehaus.org/mojo/trunk/mojo/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Thanks for your response Benjamin, it helped me a lot !

Olivier

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to