Hi

Thnx, that did it (now why did I not think of trying that). What happens next 
must some how be related to some versioning problem I guess:

In my mojo I call the embedder to have it execute a goal, but it bombs out with 
the following:

Embedded error: Cannot lookup required component.
Component composition failed. No field of type: 'class org.apache.maven.usabilit
y.diagnostics.ErrorDiagnostics' exists in class 'org.apache.maven.DefaultMaven'.
 Component: role: 'org.apache.maven.Maven', implementation: 'org.apache.maven.De
faultMaven'

and the stacktrace is:

org.apache.maven.lifecycle.LifecycleExecutionException: Embedder
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:559)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
[snip]
Caused by: org.apache.maven.plugin.MojoExecutionException: Embedder
        at no.dnbnor.it01.maven.ProjectCreator.execute(ProjectCreator.java:53)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:412)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:534)
[snip]
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupExc
eption: Unable to lookup component 'org.apache.maven.Maven', it could not be sta
rted
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.java:339)
        at org.codehaus.plexus.embed.Embedder.lookup(Embedder.java:78)
[snip]
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLifecycle
Exception: Error starting component
        at org.codehaus.plexus.component.manager.AbstractComponentManager.startC
omponentLifecycle(AbstractComponentManager.java:109)
[snip]
Caused by: org.codehaus.plexus.component.composition.CompositionException: Compo
nent composition failed. No field of type: 'class org.apache.maven.usability.dia
gnostics.ErrorDiagnostics' exists in class 'org.apache.maven.DefaultMaven'. Comp
onent: role: 'org.apache.maven.Maven', implementation: 'org.apache.maven.Default
Maven'

Hermod

-----Original Message-----
From: Jason van Zyl [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 29, 2006 12:28 PM
To: Maven Developers List
Subject: Re: Executing mojo without a pom.



On 29 Jun 06, at 5:22 AM 29 Jun 06, <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]> wrote:

> Hi
>
> That is what I thought too, but I have a very simple mojo (that  
> does no have @requiresProject set) that when run complains that:
>
> [INFO] Cannot execute mojo: generate. It requires a project with an  
> existing pom
> .xml, but the build is not using one.
>

Sorry Hermod, it is set to true by default so in your Mojo you  
specifically have to say that you don't need a project using

@requiresProject false

You can take a look at the archetype plugin to see an example of this  
in action:

http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype/ 
maven-archetype-plugin/src/main/java/org/apache/maven/plugin/ 
archetype/MavenArchetypeMojo.java?view=markup

Jason.

> Hermod
>
> -----Original Message-----
> From: Jason van Zyl [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 28, 2006 1:20 PM
> To: Maven Developers List
> Subject: Re: Executing mojo without a pom.
>
>
>
> On 28 Jun 06, at 11:18 AM 28 Jun 06, <[EMAIL PROTECTED]>
> <[EMAIL PROTECTED]> wrote:
>
>> Hi
>>
>> As part of a an initial project setup, I want to execute a mojo
>> that I have written (sort of like archetyep:create). At this stage
>> the pom is not available, so I was wondering how to specify that
>> the mojo does not require a pom.
>>
>
> By default a Mojo does not require a POM. You must specify when your
> Mojo needs a maven project you enforce that by using the
> @requiresProject in your Mojo. When Maven inspects the metadata for a
> plugin before executing a Mojo (DefaultPluginManager) it will check
> this flag and throw an exception if there is no pom.xml file present.
> But by default you don't need a pom.xml file to have your Mojo  
> execute.
>
> Jason.
>
>> Hermod
>>
>>
>> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>> * * * *
>>
>> This email with attachments is solely for the use of the  
>> individual or
>> entity to whom it is addressed. Please also be aware that DnB NOR
>> cannot
>> accept any payment orders or other legally binding correspondence  
>> with
>> customers as a part of an email.
>>
>> This email message has been virus checked by the anti virus
>> programs used
>> in the DnB NOR Group.
>>
>> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>> * * * *
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> Jason van Zyl
> [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------------------------------------------
> 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]
>
>

Jason van Zyl
[EMAIL PROTECTED]




---------------------------------------------------------------------
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