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:[email protected]]
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
<[email protected]> wrote:
> What is inside the getClassPath() method?
>
> On Mar 3, 2009, at 8:58 AM, "Roman Kournjaev" <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>

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



Reply via email to