On Sat, 27 May 2006, Ovidio Mallo wrote:

Hi,

Well, currently running archetype:create seems the simplest way to me.
The embedder is primarily meant to build projects, not to create them.

You might want to take a look at the maven-cli project. Some plugins, like
archetype, don't require an existing pom.xml.

A sequence like this (more or less) should work for you:

MavenEmbedder embedder = new MavenEmbedder();

embedder.start();

Settings settings = embedder.buildSettings(
        embedder.getUserSettingsPath( null ),
        embedder.getGlobalSettingsPath(),
        false,
        false,
        false,
        false );

Properties properties = new Properties();
// set archetype parameters in properties

MavenExecutionRequest request = new DefaultMavenExecutionRequest()
        .setBasedir(..)
        .setGoals( Arrays.asList( new String[] { "archetype.create" } )
        .setLocalRepositoryPath( embedder.getLocalRepositoryPath( settings )
        .setSettings( settings )
        .setProperties( properties );

embedder.execute( request );

.. and we don't set a pom file here.

Good luck!

-- Kenney


> Hi everyone!
>
> I just wanted to ask whether there is a clean way to create a new maven
> project using the MavenEmbedder API. It is of course possible to
> execute the "archetype:create" goal but the API seems to always
> require that you already pass in an existing project (at least
> an existing pom.xml file) in order to execute any goal.
> I think such a feature would be quite handy for other projects
> such as the Maven2 Eclipse Plugin.
>
> Thanks in advance for any help!
>
> Regards,
>    Ovidio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to