MG>Elmar MG>If you believe maven-embedder lacks documentation on generating
archetypes
MG>perhaps you can gain insight into how archetypes are generated by want
reading these URLS
MG>http://maven.apache.org/ref/3.0.2/maven-embedder/team-list.htmlMG>http://maven.apache.org/archetype/maven-archetype-plugin/generate-mojo.html
MG>to get started on generating archetypes
MG>Take a Look at how to generate the parameters using in
maven-archetype-plugin archetypeArtifactIdString-The archetype's artifactId.
archetypeCatalogString-The archetype catalogs to use to build a list and let
the user choose from. It is a comma separated list of catalogs. Catalogs use
following schemes: •'file://...' witharchetype-catalog.xml automatically
appended when pointing to a directory
•'http://...' or 'https://...' with archetype-catalog.xml appended
•'local' which is the shortcut for 'file://~/.m2/archetype-catalog.xml'
•'remote' which is the shortcut for Maven Central repository, ie
'http://repo1.maven.org/maven2'
•'internal' which is an internal catalog
Since 2.0-alpha-5, default value is no longerinternal,local but remote,local.
If Maven Central repository catalog file is empty, internalcatalog is used
instead.
Default value is: remote,local.
archetypeGroupIdString-The archetype's groupId.
archetypeRepositoryString-The archetype's repository.
archetypeVersionString-The archetype's version.
basedirFile-(no description)
filterString2.1Applying some filter on displayed archetypes list: format
isartifactId or groupId:artifactId. •org.apache: -> displays all archetypes
which contain org.apache in groupId
•:jee or jee -> displays all archetypes which contain jee in artifactId
•org.apache:jee -> displays all archetypes which contain org.apache in groupId
AND jee in artifactId
goalsString-Additional goals to immediately run on the project created from the
archetype.
MG>If you want your user to have a user-selectable list specify catalog
MG>filter would be used to filter the presented archetypes , (jee or jdk come
to mind)
MG>goals are another important aspect as each mojo can contain multiple actions
(mojo)
MG>interactive would be a good idea to gain feedback from your client (but not
if its called by embedder)I am attaching a sample archetype-catalog.xml for
your perusal
MG>This sounds like quite an interesting project you are working on
MG>Please feel free to ping back for questions\comments and or advice Bedankt,
Martin
______________________________________________
Gelieve niet veranderen of verstoren deze transmissie
> From: elm...@infosupport.com
> To: dev@maven.apache.org
> CC: jor...@infosupport.com
> Subject: Run maven commands from Java code
> Date: Mon, 13 May 2013 13:03:12 +0000
>
> Dear sir/madame,
>
> I'm Elmar Maan and I'm studying software engineering in Holland.
>
> I'm developing a desktop application, that can easily generate maven modules,
> inside a Maven project.
> This will be a JavaFX application, so I need to call Maven commands from Java
> code.
>
> This is what I've tried:
> First I tried to use the Maven library, which I found in the Maven central
> repository. (org.apache.maven.archetype: archetype-common 2.2)
> I wanted to use the DefaultArchetypeManager the generate a project from an
> archetype (generateProjectFromArchetype(ArchtypeRequest, request)
>
> This gave me a lot of nullpointer exceptions, because almost all the classes
> that it uses are interfaces, which are never initialized.
>
> So after three days of struggling with the library, I had no results.
> Then I found the maven-embedder library.
> This library lets me run the maven command-line commands, like mvn
> archetype:generate, and works just fine, but I think it's deprecated, because
> there is no more information on the maven site.
>
> Also the library I used earlier has less or zero documentation or examples.
>
> My question is, What's the best way to call the maven archetype:generate
> command, so I can generate archetypes from remote catalogs etc.
> Is there another library, or am i developing something that is not even
> possible?
>
> Yours sincerely,
>
> Elmar Maan
> student
>
> e-mail: mailto:elm...@infosupport.com
> mobiel: +31 (0)652 290 928
>
> Info Support
> Kruisboog 42
> 3905 TG Veenendaal
> tel: +31 (0)318 55 20 20
> fax: + 31 (0)318 55 23 55
> www.infosupport.com<http://www.infosupport.com/>
>
>
> Op dit e-mailbericht is de disclaimer van Info Support van toepassing, zie
> http://www.infosupport.com/disclaimer