The project variable (which doesn't need to be named project) should be 
injected by Plexus. Here's an example:
 
    /**
     * @parameter expression="${project}"
     * @required
     * @readonly
     */
    private MavenProject project;


________________________________

From: Roman Kournjaev [mailto:kournj...@gmail.com]
Sent: Tue 3/3/2009 9:55 AM
To: Maven Users List
Subject: Re: Executing another process from maven plugin



Thanks Justin

If that works , then this is the solution for my problem , but i just cant
find the *project.getCompileClasspathElements()* , where do i get the *project
*variable from ? I didnt see it in the AbstractMojo class?

Thanks

On Tue, Mar 3, 2009 at 4:40 PM, Edelson, Justin <justin.edel...@mtvstaff.com>
wrote:
> I believe that will give you the class path of the current process, which
is why you're getting Maven stuff.
>
> If you're trying to get project dependencies, what you want to do is
include this annotation in your class comments:
> @requiresDependencyResolution compile
>
> And then, use project.getCompileClasspathElements() to get the list of
compile-scoped classpath elements.
>
> Justin
>
>
> ________________________________
>
> From: Roman Kournjaev [mailto:kournj...@gmail.com]
> Sent: Tue 3/3/2009 9:29 AM
> To: Maven Users List
> Subject: Re: Executing another process from maven plugin
>
>
>
> Ohh, Sorry
>
> Just the regular thing .. :     private static String getClassPath() {
>                                                  return
> prop.getProperty("java.class.path", null);
>                                        }
>
> Roman
>
>
> On Tue, Mar 3, 2009 at 4:26 PM, Edelson, Justin
> <justin.edel...@mtvstaff.com> wrote:
>> What is inside the getClassPath() method?
>>
>> On Mar 3, 2009, at 8:58 AM, "Roman Kournjaev" <kournj...@gmail.com>
wrote:
>>
>>> Hi Folks
>>>
>>> I am a little bit stuck here with the following problem.
>>>
>>> I have written some custom compiler plugin that invokes the actual
>>> compiler,
>>> the problem is that i have to do it in a separate process
>>> Runtime.exec(....)
>>>
>>> It goes like that :
>>>
>>>           Process process = null;
>>>           String command = "java -cp \"" + getClassPath() + "\" "  +
>>> AgentCompiler.class.getCanonicalName() + " " + cmd;
>>>           getLog().info("executing : " + command);
>>>           process = Runtime.getRuntime().exec(command);
>>>
>>>
>>> Well, when i run it from plain java , it works fine ... :-)
>>>
>>> When i run it as a plugin actually , then i get crappy stuff in my
>>> classpath
>>> ,everything from maven , but nothing that i actually defined in my
pom.xml
>>> inside the plugin.
>>>
>>> I also tried to add these dependecies (plugin dependencies) inside the
>>> <plugin><dependencies> tag , inside the pom.xml that makes use of that
>>> plugin , but also in vain , i still get the same classpath.
>>>
>>> So long story short .. How to the the needed classpath for running a
>>> process
>>> outside a maven plugin ???
>>>
>>> Thanks in advance.
>>>
>>> Roman
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>
>
>


Reply via email to