You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by dreedyman <de...@gmail.com> on 2009/10/16 15:54:32 UTC

Standalone Maven Embedder

Hi,

I am trying to use the maven-embedder outside of my Maven project and have
not been successful. I'm hoping someone can lend some assistance.

The code tries to get the PlexusContainer from the embedder in order to
lookup the ArtifactResolver, ArtifactFactory, ArtifactMetadataSource and
MavenProjectBuilder components.

This all works fine when testing the code from my project, but when trying
to use the jar (created by shade)  standalone it fails as follows:

org.apache.maven.embedder.MavenEmbedderException: Cannot lookup required
component.
	at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java:669)
	at org.apache.maven.embedder.MavenEmbedder.<init>(MavenEmbedder.java:176)
	at
org.rioproject.resolver.maven.MavenResolver.getClassPathFor(MavenResolver.java:92)
	at org.rioproject.resolver.maven.MavenResolver.main(MavenResolver.java:55)
Caused by:
org.codehaus.plexus.component.repository.exception.ComponentLookupException:
Component descriptor cannot be found in the component repository
      role: org.apache.maven.Maven
  roleHint: default
classRealm: none specified
	at
org.codehaus.plexus.DefaultComponentRegistry.getComponentManager(DefaultComponentRegistry.java:367)
	at
org.codehaus.plexus.DefaultComponentRegistry.getComponent(DefaultComponentRegistry.java:322)
	at
org.codehaus.plexus.DefaultComponentRegistry.lookup(DefaultComponentRegistry.java:163)
	at
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:355)
	at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java:641)
	... 3 more

Why does this fail? Are there configuration files missing? Something else?

Thanks

Dennis
-- 
View this message in context: http://www.nabble.com/Standalone-Maven-Embedder-tp25925809p25925809.html
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: Standalone Maven Embedder

Posted by Jason van Zyl <ja...@sonatype.com>.
On 2009-10-16, at 5:59 PM, dreedyman wrote:

>
> Jason,
>
> Thanks for the followup. I've taken a look at m2eclipse, and I  
> frankly dont
> see any examples of how to use embedding in a standalone way.  
> Perhaps you
> can point me to specific references?
>
> The fundamental issue here seems to be bootstrapping the maven  
> environment
> via the plexus container. It seems that we are either bound to  
> running in a
> maven context, or running in Eclipse. The obvious requirement is  
> running
> *standalone*.
>
> I'm being careful here to avoid a rant, but I must say that while  
> I'm glad
> that "it will be supported as a whole for the community", right now  
> using
> this project from an API perspective is not what I expected.
>

Let me set your expectations then.

The number one priority for 3.0 is backward compatibility and  
stability. It has been no small task and we don't have infinite time.  
Settling on a set of APIs for embedding and documenting them will take  
time. It's going to be a non-traditional approach in Maven in that  
there is going to be documentation when they are published. We have  
ripped them apart internally and we are still changing them. We are  
not prepared to answer any questions about them because we are going  
to work toward solidifying a first version and writing documentation  
and then ask for feedback. If you expect us to document everything as  
we go along and provide perfectly working example then you expected  
wrong. It's an OSS project and it moves at the speed it moves at.

What we care about is making sure all our ITs run correctly and that's  
all we care about right now. Everything else is secondary at this point.


> Dennis
>
>
> jvanzyl wrote:
>>
>> That it won't be supported until the 3.0 betas. The APIs are still
>> changing and official will arrive with documentation. Until then  
>> there
>> are plenty of examples in m2eclipse. It will be supported as a whole
>> for the whole community when it's ready.
>>
>> There is no ETA for 3.0 yet.
>>
>> On 2009-10-16, at 9:06 AM, dreedyman wrote:
>>
>>>
>>> Wow, I cant tell you how disappointed I am. Not just that the Maven
>>> team will
>>> not be supporting embedding in the 3.0 betas, but the brush off of
>>> "go read
>>> the source code".
>>>
>>> So when is the delivery plan for 3.0 release planned?
>>>
>>>
>>> jvanzyl wrote:
>>>>
>>>> As I've stated on the dev list the embedder, or more accurately,
>>>> embedding will not be supported in the Maven 3.0 betas. Reading the
>>>> source code, or looking at M2Eclipse are your options for now.
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Standalone-Maven-Embedder-tp25925809p25926966.html
>>> 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
>>>
>>
>> Thanks,
>>
>> Jason
>>
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder,  Apache Maven
>> http://twitter.com/jvanzyl
>> ----------------------------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Standalone-Maven-Embedder-tp25925809p25933947.html
> 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
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Standalone Maven Embedder

Posted by Espen Wiborg <es...@telio.no>.
dreedyman <de...@gmail.com> writes:
> Thanks for the followup. I've taken a look at m2eclipse, and I frankly
> dont see any examples of how to use embedding in a standalone
> way. Perhaps you can point me to specific references?
>
> The fundamental issue here seems to be bootstrapping the maven
> environment via the plexus container. It seems that we are either
> bound to running in a maven context, or running in Eclipse. The
> obvious requirement is running *standalone*.

You may find some help in the code I've written for my Emacs
integration; check http://github.com/espenhw/malabar-mode (and
especially
http://github.com/espenhw/malabar-mode/blob/master/src/main/groovy/org/grumblesmurf/malabar/MvnServer.groovy)
for how I do it.

I've sto.. er, "borrowed" a lot of code from 
http://svn.eu.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?view=markup

which seems to be the currently-canonical way of bootstrapping Maven.

-- 
Espen Wiborg <es...@telio.no> - Veritas vos liberabit
"Memory is like an orgasm. It's a lot better if you don't have to fake it."
  -- Seymour Cray, on virtual memory

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Standalone Maven Embedder

Posted by dreedyman <de...@gmail.com>.
Jason,

Thanks for the followup. I've taken a look at m2eclipse, and I frankly dont
see any examples of how to use embedding in a standalone way. Perhaps you
can point me to specific references?

The fundamental issue here seems to be bootstrapping the maven environment
via the plexus container. It seems that we are either bound to running in a
maven context, or running in Eclipse. The obvious requirement is running
*standalone*. 

I'm being careful here to avoid a rant, but I must say that while I'm glad
that "it will be supported as a whole for the community", right now using
this project from an API perspective is not what I expected.

Dennis


jvanzyl wrote:
> 
> That it won't be supported until the 3.0 betas. The APIs are still  
> changing and official will arrive with documentation. Until then there  
> are plenty of examples in m2eclipse. It will be supported as a whole  
> for the whole community when it's ready.
> 
> There is no ETA for 3.0 yet.
> 
> On 2009-10-16, at 9:06 AM, dreedyman wrote:
> 
>>
>> Wow, I cant tell you how disappointed I am. Not just that the Maven  
>> team will
>> not be supporting embedding in the 3.0 betas, but the brush off of  
>> "go read
>> the source code".
>>
>> So when is the delivery plan for 3.0 release planned?
>>
>>
>> jvanzyl wrote:
>>>
>>> As I've stated on the dev list the embedder, or more accurately,
>>> embedding will not be supported in the Maven 3.0 betas. Reading the
>>> source code, or looking at M2Eclipse are your options for now.
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Standalone-Maven-Embedder-tp25925809p25926966.html
>> 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
>>
> 
> Thanks,
> 
> Jason
> 
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ----------------------------------------------------------
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Standalone-Maven-Embedder-tp25925809p25933947.html
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: Standalone Maven Embedder

Posted by Jason van Zyl <ja...@sonatype.com>.
That it won't be supported until the 3.0 betas. The APIs are still  
changing and official will arrive with documentation. Until then there  
are plenty of examples in m2eclipse. It will be supported as a whole  
for the whole community when it's ready.

There is no ETA for 3.0 yet.

On 2009-10-16, at 9:06 AM, dreedyman wrote:

>
> Wow, I cant tell you how disappointed I am. Not just that the Maven  
> team will
> not be supporting embedding in the 3.0 betas, but the brush off of  
> "go read
> the source code".
>
> So when is the delivery plan for 3.0 release planned?
>
>
> jvanzyl wrote:
>>
>> As I've stated on the dev list the embedder, or more accurately,
>> embedding will not be supported in the Maven 3.0 betas. Reading the
>> source code, or looking at M2Eclipse are your options for now.
>>
>
> -- 
> View this message in context: http://www.nabble.com/Standalone-Maven-Embedder-tp25925809p25926966.html
> 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
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Standalone Maven Embedder

Posted by dreedyman <de...@gmail.com>.
Wow, I cant tell you how disappointed I am. Not just that the Maven team will
not be supporting embedding in the 3.0 betas, but the brush off of "go read
the source code".

So when is the delivery plan for 3.0 release planned?


jvanzyl wrote:
> 
> As I've stated on the dev list the embedder, or more accurately,  
> embedding will not be supported in the Maven 3.0 betas. Reading the  
> source code, or looking at M2Eclipse are your options for now.
> 

-- 
View this message in context: http://www.nabble.com/Standalone-Maven-Embedder-tp25925809p25926966.html
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: Standalone Maven Embedder

Posted by Jason van Zyl <ja...@sonatype.com>.
As I've stated on the dev list the embedder, or more accurately,  
embedding will not be supported in the Maven 3.0 betas. Reading the  
source code, or looking at M2Eclipse are your options for now.

On 2009-10-16, at 7:54 AM, dreedyman wrote:

>
> Hi,
>
> I am trying to use the maven-embedder outside of my Maven project  
> and have
> not been successful. I'm hoping someone can lend some assistance.
>
> The code tries to get the PlexusContainer from the embedder in order  
> to
> lookup the ArtifactResolver, ArtifactFactory, ArtifactMetadataSource  
> and
> MavenProjectBuilder components.
>
> This all works fine when testing the code from my project, but when  
> trying
> to use the jar (created by shade)  standalone it fails as follows:
>
> org.apache.maven.embedder.MavenEmbedderException: Cannot lookup  
> required
> component.
> 	at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java: 
> 669)
> 	at org.apache.maven.embedder.MavenEmbedder.<init> 
> (MavenEmbedder.java:176)
> 	at
> org.rioproject.resolver.maven.MavenResolver.getClassPathFor 
> (MavenResolver.java:92)
> 	at org.rioproject.resolver.maven.MavenResolver.main 
> (MavenResolver.java:55)
> Caused by:
> org.codehaus.plexus.component.repository.exception.ComponentLookupException 
> :
> Component descriptor cannot be found in the component repository
>      role: org.apache.maven.Maven
>  roleHint: default
> classRealm: none specified
> 	at
> org.codehaus.plexus.DefaultComponentRegistry.getComponentManager 
> (DefaultComponentRegistry.java:367)
> 	at
> org.codehaus.plexus.DefaultComponentRegistry.getComponent 
> (DefaultComponentRegistry.java:322)
> 	at
> org.codehaus.plexus.DefaultComponentRegistry.lookup 
> (DefaultComponentRegistry.java:163)
> 	at
> org.codehaus.plexus.DefaultPlexusContainer.lookup 
> (DefaultPlexusContainer.java:355)
> 	at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java: 
> 641)
> 	... 3 more
>
> Why does this fail? Are there configuration files missing? Something  
> else?
>
> Thanks
>
> Dennis
> -- 
> View this message in context: http://www.nabble.com/Standalone-Maven-Embedder-tp25925809p25925809.html
> 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
>

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
----------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org