Hi Justin

You saved me a lot of headache !

Thanks a lot !


On Tue, Mar 3, 2009 at 10:02 PM, Edelson, Justin <
justin.edel...@mtvstaff.com> wrote:

> It looks like I was wrong about there not being an easy way to get the
> plugin classpath. From the Cobertura plugin:
>
>    /**
>     * <i>Maven Internal</i>: List of artifacts for the plugin.
>     *
>     * @parameter expression="${plugin.artifacts}"
>     * @required
>     * @readonly
>     */
>    protected List pluginClasspathList;
>
> This contains a list of org.apache.maven.artifact.Artifact objects.
>
> The Cobertura uses the pattern you are describing, so I would suggest
> you take a look at it.
>
> Justin
>
>
>
> -----Original Message-----
> From: Roman Kournjaev [mailto:kournj...@gmail.com]
> Sent: Tuesday, March 03, 2009 10:30 AM
> To: Maven Users List
> Subject: Re: Executing another process from maven plugin
>
> Justin , just one more small question.
>
> The project.getCompileClasspathElements() , gets me the elements of the
> classpath of the project that the plugin is actually running , but not
> of the plugin itself , so i had to add plugin dependencies also to the
> pom.xml where the plugin is configured. Is there a way to get the plugin
> classpath too ?
>
> Thanks in advnace
>
> Roman
>
>
> On Tue, Mar 3, 2009 at 4:59 PM, Edelson, Justin
> <justin.edel...@mtvstaff.com
> > wrote:
>
> > 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
> > >
> > >
> > >
> > >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to