You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Martin Bengl <ma...@dailyspring.net> on 2007/05/03 13:22:01 UTC
M2-Plugin Development: Reading POM programmatically
hello folks,
I use following solution (with maven 2.0.4) to create a MavenProject at
runtime to extract informations like artifactId and groupid - this could
be also done by manually parsing the xml file - but i think its a better
way to use the maven classes.
File pomFile = new File("pom.xml");
MavenProjectBuilder projectBuilder;
ArtifactRepository localRepository;
MavenProject pom = projectBuilder.build(pomFile, localRepository,
(ProfileManager)null );
My Question is: From which object can I receive a profileManager
instance? (the projectBuilder and localRepository are defined as plexus
components, the profileManager isn't!)
greetings
martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: M2-Plugin Development: Reading POM programmatically
Posted by Mark Hobson <ma...@gmail.com>.
Hi Martin,
On 04/05/07, Martin Bengl <ma...@dailyspring.net> wrote:
> Hello Mark,
>
> thanks a lot - where do you get such information from?
> From my point of view maven is not well documentated, isn't it?
Mainly from digging around the source code. I do agree writing and
publishing some javadoc would lessen the learning curve..
> can i get your shared component somewhere before it's submitted and
> is there already a jira entry to vote for it?
I'll try to submit an initial version shortly via JIRA and will send
an announcement to the dev list.
Cheers,
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: M2-Plugin Development: Reading POM programmatically
Posted by Martin Bengl <ma...@dailyspring.net>.
Hello Mark,
thanks a lot - where do you get such information from?
From my point of view maven is not well documentated, isn't it?
can i get your shared component somewhere before it's submitted and
is there already a jira entry to vote for it?
greetings
Martin
Mark Hobson schrieb:
> On 03/05/07, Martin Bengl <ma...@dailyspring.net> wrote:
>> hello folks,
>>
>> I use following solution (with maven 2.0.4) to create a MavenProject at
>> runtime to extract informations like artifactId and groupid - this could
>> be also done by manually parsing the xml file - but i think its a better
>> way to use the maven classes.
>>
>> File pomFile = new File("pom.xml");
>> MavenProjectBuilder projectBuilder;
>> ArtifactRepository localRepository;
>>
>> MavenProject pom = projectBuilder.build(pomFile, localRepository,
>> (ProfileManager)null );
>>
>> My Question is: From which object can I receive a profileManager
>> instance? (the projectBuilder and localRepository are defined as plexus
>> components, the profileManager isn't!)
>
> To simply parse the pom into a MavenProject, use something like:
>
> MavenXpp3Reader reader = new MavenXpp3Reader();
> Model model = reader.read(myreader);
> MavenProject project = new MavenProject(model);
>
> I've got a shared component to help with introspecting the Maven
> environment, as you describe, which I'm hoping to submit when I get a
> chance.
>
> Cheers,
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: M2-Plugin Development: Reading POM programmatically
Posted by Mark Hobson <ma...@gmail.com>.
On 03/05/07, Martin Bengl <ma...@dailyspring.net> wrote:
> hello folks,
>
> I use following solution (with maven 2.0.4) to create a MavenProject at
> runtime to extract informations like artifactId and groupid - this could
> be also done by manually parsing the xml file - but i think its a better
> way to use the maven classes.
>
> File pomFile = new File("pom.xml");
> MavenProjectBuilder projectBuilder;
> ArtifactRepository localRepository;
>
> MavenProject pom = projectBuilder.build(pomFile, localRepository,
> (ProfileManager)null );
>
> My Question is: From which object can I receive a profileManager
> instance? (the projectBuilder and localRepository are defined as plexus
> components, the profileManager isn't!)
To simply parse the pom into a MavenProject, use something like:
MavenXpp3Reader reader = new MavenXpp3Reader();
Model model = reader.read(myreader);
MavenProject project = new MavenProject(model);
I've got a shared component to help with introspecting the Maven
environment, as you describe, which I'm hoping to submit when I get a
chance.
Cheers,
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org