Hi Like this:
MavenEmbedder embedder = new MavenEmbedder(); embedder.setClassLoader(Thread.currentThread().getContextClassLoader()); MavenEmbedderConsoleLogger logger = new MavenEmbedderConsoleLogger(); embedder.setLogger(logger); try { embedder.start(); } catch (MavenEmbedderException mee) { throw new MojoExecutionException("Embedder",mee); } Settings settings; try { settings = embedder.buildSettings(embedder .getUserSettingsPath(null), embedder.getGlobalSettingsPath(), false, false, false, Boolean.FALSE); } catch (SettingsConfigurationException sce) { throw new MojoExecutionException("Embedder",sce); } Properties main_props = new Properties(); main_props.put("groupId", "whatever"); main_props.put("artifactId", "whatever"); main_props.put("name", "whatever"); main_props.put("version", "whatever"); List goals = new ArrayList(); goals.add("archetype:create"); MavenExecutionRequest request = new DefaultMavenExecutionRequest() .setBasedir(new File("c:/Temp")).setGoals(goals) .setLocalRepositoryPath( embedder.getLocalRepositoryPath(settings)) .setSettings( settings) .setProperties(main_props) .addEventMonitor( new DefaultEventMonitor(new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG, "logger"))); try { embedder.execute(request); } catch (MavenExecutionException mee) { throw new MojoExecutionException("Embedder",mee); } Hermod -----Original Message----- From: Israel Klein [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 21, 2006 10:55 PM To: users@maven.apache.org Subject: calling an archetype goal from embedder Hello List, How can I call an archetype:create goal using the embedder? Do I have to have a fake pom.xml for that? how can I pass the parameters? (archetypeGroupId, for example) Thanks, -- Israel Klein * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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]