You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Harshana Eranga Martin <ha...@gmail.com> on 2011/02/05 11:31:08 UTC

NPE from org.apache.maven.archetype.DefaultArchetypeManager of archetype-common-2.0.jar

Hi All,

I'm trying to use maven archetypes programmatically to create a maven
project.

While I'm looking at the source code of the class *DefaultArchetypeManager*of
*archetype-common-2.0.jar*, I see possible NPEs from the
*generateProjectFromArchetype
*method and *createArchetypeFromProject *method. The causes are, these
methods try to invoke methods on *ArchetypeGenerator *and *ArchetypeCreator
*references without instantiating them.

Is this a known situation or a bug?


Thanks and Regards,
Harshana Martin
--
Harshana Eranga Martin
Software Engineer,
WSO2 Inc.
Web: http://wso2.com
           http://wso2.org

ECF Committer: http://www.eclipse.org/ecf/
Blog: http://harshana05.blogspot.com
Profile: https://www.google.com/profiles/harshana05

Re: NPE from org.apache.maven.archetype.DefaultArchetypeManager of archetype-common-2.0.jar

Posted by Harshana Eranga Martin <ha...@gmail.com>.
Hi Hervé,

I followed your reference and understood the relationship between Plexus and
Maven and how Plexus is used to invoke Maven components. I got my work done
using Maven Invoker (shared component) API [0].

[0]. http://maven.apache.org/shared/maven-invoker/

Thanks and Regards,
Harshana

On 6 February 2011 00:02, Harshana Eranga Martin <ha...@gmail.com>wrote:

> Hi Hervé,
>
>  On 5 February 2011 18:30, Hervé BOUTEMY <he...@free.fr> wrote:
>
>>  archetype-common, like any other Maven component, does not instanciate
>> components directly but uses plexus container as dependency injection
>> toolkit.
>> Maven core does the container initialization for Maven usage, but if
>> you're
>> creating a standalone application, you have to init the container yourself
>> and
>> retrieve the first component.
>> See "Executing the Plexus Application" in Plexus quickstart [1].
>>
>
> Thanks for the information and reference. I'll follow up if I have more
> questions on this.
>
> Thanks and Regards,
> Harshana
>
>>
>> Regards,
>>
>> Hervé
>>
>> [1] http://plexus.codehaus.org/guides/quick-start/getting-started.html
>>
>> Le samedi 5 février 2011, Harshana Eranga Martin a écrit :
>> > Hi All,
>> >
>> > I'm trying to use maven archetypes programmatically to create a maven
>> > project.
>> >
>> > While I'm looking at the source code of the class
>> > *DefaultArchetypeManager*of *archetype-common-2.0.jar*, I see possible
>> > NPEs from the
>> > *generateProjectFromArchetype
>> > *method and *createArchetypeFromProject *method. The causes are, these
>> > methods try to invoke methods on *ArchetypeGenerator *and
>> *ArchetypeCreator
>> > *references without instantiating them.
>> >
>> > Is this a known situation or a bug?
>> >
>> >
>> > Thanks and Regards,
>> > Harshana Martin
>> > --
>> > Harshana Eranga Martin
>> > Software Engineer,
>> > WSO2 Inc.
>> > Web: http://wso2.com
>> >            http://wso2.org
>> >
>> > ECF Committer: http://www.eclipse.org/ecf/
>> > Blog: http://harshana05.blogspot.com
>> > Profile: https://www.google.com/profiles/harshana05
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>
>
> --
> Thanks and Regards,
> Harshana Martin
> --
> Harshana Eranga Martin
> Software Engineer,
> WSO2 Inc.
> Web: http://wso2.com
>            http://wso2.org
>
> ECF Committer: http://www.eclipse.org/ecf/
> Blog: http://harshana05.blogspot.com
> Profile: https://www.google.com/profiles/harshana05
>
>


-- 
Thanks and Regards,
Harshana Martin
--
Harshana Eranga Martin
Software Engineer,
WSO2 Inc.
Web: http://wso2.com
           http://wso2.org

ECF Committer: http://www.eclipse.org/ecf/
Blog: http://harshana05.blogspot.com
Profile: https://www.google.com/profiles/harshana05

Re: NPE from org.apache.maven.archetype.DefaultArchetypeManager of archetype-common-2.0.jar

Posted by Harshana Eranga Martin <ha...@gmail.com>.
Hi Hervé,

On 5 February 2011 18:30, Hervé BOUTEMY <he...@free.fr> wrote:

> archetype-common, like any other Maven component, does not instanciate
> components directly but uses plexus container as dependency injection
> toolkit.
> Maven core does the container initialization for Maven usage, but if you're
> creating a standalone application, you have to init the container yourself
> and
> retrieve the first component.
> See "Executing the Plexus Application" in Plexus quickstart [1].
>

Thanks for the information and reference. I'll follow up if I have more
questions on this.

Thanks and Regards,
Harshana

>
> Regards,
>
> Hervé
>
> [1] http://plexus.codehaus.org/guides/quick-start/getting-started.html
>
> Le samedi 5 février 2011, Harshana Eranga Martin a écrit :
> > Hi All,
> >
> > I'm trying to use maven archetypes programmatically to create a maven
> > project.
> >
> > While I'm looking at the source code of the class
> > *DefaultArchetypeManager*of *archetype-common-2.0.jar*, I see possible
> > NPEs from the
> > *generateProjectFromArchetype
> > *method and *createArchetypeFromProject *method. The causes are, these
> > methods try to invoke methods on *ArchetypeGenerator *and
> *ArchetypeCreator
> > *references without instantiating them.
> >
> > Is this a known situation or a bug?
> >
> >
> > Thanks and Regards,
> > Harshana Martin
> > --
> > Harshana Eranga Martin
> > Software Engineer,
> > WSO2 Inc.
> > Web: http://wso2.com
> >            http://wso2.org
> >
> > ECF Committer: http://www.eclipse.org/ecf/
> > Blog: http://harshana05.blogspot.com
> > Profile: https://www.google.com/profiles/harshana05
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


-- 
Thanks and Regards,
Harshana Martin
--
Harshana Eranga Martin
Software Engineer,
WSO2 Inc.
Web: http://wso2.com
           http://wso2.org

ECF Committer: http://www.eclipse.org/ecf/
Blog: http://harshana05.blogspot.com
Profile: https://www.google.com/profiles/harshana05

Re: NPE from org.apache.maven.archetype.DefaultArchetypeManager of archetype-common-2.0.jar

Posted by Hervé BOUTEMY <he...@free.fr>.
archetype-common, like any other Maven component, does not instanciate 
components directly but uses plexus container as dependency injection toolkit.
Maven core does the container initialization for Maven usage, but if you're 
creating a standalone application, you have to init the container yourself and 
retrieve the first component.
See "Executing the Plexus Application" in Plexus quickstart [1] 

Regards,

Hervé

[1] http://plexus.codehaus.org/guides/quick-start/getting-started.html

Le samedi 5 février 2011, Harshana Eranga Martin a écrit :
> Hi All,
> 
> I'm trying to use maven archetypes programmatically to create a maven
> project.
> 
> While I'm looking at the source code of the class
> *DefaultArchetypeManager*of *archetype-common-2.0.jar*, I see possible
> NPEs from the
> *generateProjectFromArchetype
> *method and *createArchetypeFromProject *method. The causes are, these
> methods try to invoke methods on *ArchetypeGenerator *and *ArchetypeCreator
> *references without instantiating them.
> 
> Is this a known situation or a bug?
> 
> 
> Thanks and Regards,
> Harshana Martin
> --
> Harshana Eranga Martin
> Software Engineer,
> WSO2 Inc.
> Web: http://wso2.com
>            http://wso2.org
> 
> ECF Committer: http://www.eclipse.org/ecf/
> Blog: http://harshana05.blogspot.com
> Profile: https://www.google.com/profiles/harshana05


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