On Tue, Nov 27, 2012 at 8:39 AM, Javier Ortiz <[email protected]> wrote:
> I'm loading a Maven project as described
> here<http://stackoverflow.com/questions/4381460/get-mavenproject-from-just-the-pom-xml-pom-parser>.
> I'm trying to figure out how I can retrieve the source roots so I can
> figure out the Java classes I have so my Mojo can use them.
>
> I tried a couple of the methods in there, like getResources or
> getScriptSources without luck. Any idea?
>
> See the Stackoverflow question
> here<http://stackoverflow.com/questions/13462107/mavenproject-get-the-available-classes-for-use-on-my-plugin>
I've answered over at Stackoverflow and pasting it here also
I recommend reading more docs and looking at plugins that do similar
things for ideas on how to get things done.
====
Have you read the [plugin developers documentation][1]?
That page will link to [Plugins Cookbook][2] which links to [Mojo
Developer Cookbook][3] which has [The maven project, or the effective
pom.][4] and gives you access to
*org.apache.maven.project.MavenProject* object via
/** @parameter default-value="${project}" */
private org.apache.maven.project.MavenProject mavenProject;
You can call *[getCompileSourceRoots()][5]* to get a list of the
directories that will be used for compilation.
You will also need to do more reading about how to setup
inclusion/exclusions. You can use other plugins as examples of how to
do this, e.g. [maven-compiler-plugin][6]
[1]: http://maven.apache.org/plugin-developers/index.html
[2]: http://maven.apache.org/plugin-developers/cookbook/index.html
[3]: http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
[4]:
http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook#MojoDeveloperCookbook-Themavenprojectortheeffectivepom
[5]:
http://maven.apache.org/ref/3.0.3/maven-core/apidocs/org/apache/maven/project/MavenProject.html
[6]: http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]