You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lasse Koskela <la...@gmail.com> on 2007/01/17 03:28:36 UTC
How to make plugin see the full (project & plugin) classpath?
Hi,
I'm developing a Maven 2 plugin and I'm having trouble making my
plugin see the necessary libraries etc. in its classpath.
What I need is:
1) the plugin itself and all of its dependencies
2) the compilation classpath and all dependencies for the project
that's using the plugin
It seems that by default I don't get neither and with the ${project.*}
properties I can only get the project's classpath and dependencies but
not the plugin's.
Am I missing a property? (are they documented somewhere on one page,
by the way?)
Should I add some special annotation to my Mojo class?
Lasse
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to make plugin see the full (project & plugin) classpath?
Posted by Lasse Koskela <la...@gmail.com>.
Hi,
On 1/17/07, Niels Gylling <ng...@it-practice.dk> wrote:
> Also make sure you have the following mojo property set
> @requiresDependencyResolution compile
>
> That will populate ${plugin.artifacts}
Thanks. I had that set to "test".
I actually did get my stuff working by using the ${plugin.artifactMap}
before I saw this. I'll start using the "plugin.artifacts" instead of
"plugin.artifactMap" as it's much prettier, though.
Lasse
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to make plugin see the full (project & plugin) classpath?
Posted by Niels Gylling <ng...@it-practice.dk>.
Also make sure you have the following mojo property set
@requiresDependencyResolution compile
That will populate ${plugin.artifacts}
/Niels
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to make plugin see the full (project & plugin) classpath?
Posted by Lasse Koskela <la...@gmail.com>.
Hmm. Answering my own question, it looks like "${plugin.artifactMap}"
might do the trick. Let me report back after I've had a chance to try
it out.
Lasse
On 1/17/07, Lasse Koskela <la...@gmail.com> wrote:
> Allan, Franz,
>
> On 1/17/07, franz see <fr...@gmail.com> wrote:
> > For more information about Maven Properties, please see [1].
> > [1] http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
> >
> > allan ramirez wrote:
> > > Have you tried using ${plugin.artifacts} expression?
>
> Thanks for the tips, although I still couldn't get it working.
>
> I tried all of the artifact-related properties listed in Franz's link
> and what I'm missing is, for example, the following.
>
> My plugin's POM has a dependency to "maven-plugin-api" as follows:
>
> <project ...>
> ...
> <artifactId>jdave-maven-plugin</artifactId>
> <packaging>maven-plugin</packaging>
> <dependencies>
> <dependency>
> <groupId>org.apache.maven</groupId>
> <artifactId>maven-plugin-api</artifactId>
> <version>2.0</version>
> </dependency>
> ...
> </dependency>
> </project>
>
> And a project that's using my plugin has a plugin dependency to my plugin:
>
> <project>
> ...
> <build>
> <plugins>
> <plugin>
> <groupId>my</groupId>
> <artifactId>my-maven-plugin</artifactId>
> <executions>
> <execution>
> <phase>test</phase>
> <goals>
> <goal>test</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> </project>
>
> Now I can figure out from within "my-maven-plugin" where the plugin's
> Mojo class itself is loaded by asking the ClassLoader, for example.
> The problem is that I can't see its dependencies.
>
> The "project.pluginArtifacts" property seems to inject some stuff,
> including "my-maven-plugin" but not the plugin's dependencies. Also,
> the Artifact objects don't seem to have enough information to resolve
> to an actual .jar file in the repository (their getVersion() says
> "RELEASE"?).
>
> Lasse
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to make plugin see the full (project & plugin) classpath?
Posted by Lasse Koskela <la...@gmail.com>.
Allan, Franz,
On 1/17/07, franz see <fr...@gmail.com> wrote:
> For more information about Maven Properties, please see [1].
> [1] http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
>
> allan ramirez wrote:
> > Have you tried using ${plugin.artifacts} expression?
Thanks for the tips, although I still couldn't get it working.
I tried all of the artifact-related properties listed in Franz's link
and what I'm missing is, for example, the following.
My plugin's POM has a dependency to "maven-plugin-api" as follows:
<project ...>
...
<artifactId>jdave-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
...
</dependency>
</project>
And a project that's using my plugin has a plugin dependency to my plugin:
<project>
...
<build>
<plugins>
<plugin>
<groupId>my</groupId>
<artifactId>my-maven-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Now I can figure out from within "my-maven-plugin" where the plugin's
Mojo class itself is loaded by asking the ClassLoader, for example.
The problem is that I can't see its dependencies.
The "project.pluginArtifacts" property seems to inject some stuff,
including "my-maven-plugin" but not the plugin's dependencies. Also,
the Artifact objects don't seem to have enough information to resolve
to an actual .jar file in the repository (their getVersion() says
"RELEASE"?).
Lasse
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to make plugin see the full (project & plugin) classpath?
Posted by franz see <fr...@gmail.com>.
Good day,
For more information about Maven Properties, please see [1].
Cheers,
Franz
[1] http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
allan ramirez wrote:
>
> Have you tried using ${plugin.artifacts} expression?
>
> -allan
>
> On 1/17/07, Lasse Koskela <la...@gmail.com> wrote:
>>
>> Hi,
>>
>> I'm developing a Maven 2 plugin and I'm having trouble making my
>> plugin see the necessary libraries etc. in its classpath.
>>
>> What I need is:
>> 1) the plugin itself and all of its dependencies
>> 2) the compilation classpath and all dependencies for the project
>> that's using the plugin
>>
>> It seems that by default I don't get neither and with the ${project.*}
>> properties I can only get the project's classpath and dependencies but
>> not the plugin's.
>>
>> Am I missing a property? (are they documented somewhere on one page,
>> by the way?)
>> Should I add some special annotation to my Mojo class?
>>
>> Lasse
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> ==========================================================
> - alramirez
>
>
--
View this message in context: http://www.nabble.com/How-to-make-plugin-see-the-full-%28project---plugin%29-classpath--tf3024974s177.html#a8405940
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to make plugin see the full (project & plugin) classpath?
Posted by allan ramirez <aq...@gmail.com>.
Have you tried using ${plugin.artifacts} expression?
-allan
On 1/17/07, Lasse Koskela <la...@gmail.com> wrote:
>
> Hi,
>
> I'm developing a Maven 2 plugin and I'm having trouble making my
> plugin see the necessary libraries etc. in its classpath.
>
> What I need is:
> 1) the plugin itself and all of its dependencies
> 2) the compilation classpath and all dependencies for the project
> that's using the plugin
>
> It seems that by default I don't get neither and with the ${project.*}
> properties I can only get the project's classpath and dependencies but
> not the plugin's.
>
> Am I missing a property? (are they documented somewhere on one page,
> by the way?)
> Should I add some special annotation to my Mojo class?
>
> Lasse
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
==========================================================
- alramirez