**BREAKING CHANGES**: Use "mvn archetype:generate" to generate 1.1-SNAPSHOT archetypes

15 views
Skip to first unread message

Indrajit Raychaudhuri

unread,
Dec 1, 2009, 9:28:25 AM12/1/09
to lift-announce, lif...@googlegroups.com
Friends,

Following the recent refactoring that the Lift archetypes went though,
we have moved forward to the new archetype metadata format [1] for all
the archetypes.

So far, the JPA related archetypes were using the new metadata format
while the others (esp. lift-archetype-blank and lift-archetype-basic)
were still on the old format. Moving to the new metadata format helps
us keep things consistent, comply with Maven's recommendation and open
the archetypes up for additional future enhancements.

From now on, the recommended Maven goal to generate projects from
archetype is to use "archetype:generate" [2]. The currently deprecated
Maven goal "archetype:create" [3] would not work to give expected
result and thus is not recommended anymore.

Therefore, to generate project from the archetypes in the master you
would use a command of the form:

mvn archetype:generate \
-DarchetypeRepository=http://scala-tools.org/repo-snapshots \
-DremoteRepositories=http://scala-tools.org/repo-snapshots \
-DarchetypeGroupId=net.liftweb \
-DarchetypeArtifactId=lift-archetype-blank \
-DarchetypeVersion=1.1-SNAPSHOT \
-DgroupId=com.mypackage \
-DartifactId=myproject \
-Dversion=1.0-SNAPSHOT

Currently, the possible archetypeArtifactId are:
- lift-archetype-blank
- lift-archetype-basic
- lift-archetype-jpa-blank-single
- lift-archetype-jpa-blank
- lift-archetype-jpa-basic

If you create project interactively (default behavior), -DgroupId, -
DartifactId, -Dversion are optional. Maven would prompt for these
values (and some more) interactively.

On the other hand, if you are using a batch/shell script to generate
project non-interactively, you would need to add at least -DgroupId, -
DartifactId and additionally set -DinteractiveMode=false.


Cheers, Indrajit

References:
[1] http://maven.apache.org/plugins/maven-archetype-plugin/specification/archetype-metadata.html
[2] http://maven.apache.org/plugins/maven-archetype-plugin/generate-mojo.html
[3] http://maven.apache.org/plugins/maven-archetype-plugin/create-mojo.html

joseph hirn

unread,
Dec 27, 2009, 3:05:55 PM12/27/09
to Lift
Hello Indrajitr,

When using archetype:generate without the command line args, why does
it not build the latest release of the archetype? I saw that 1.1-M8 is
in central but the version it builds uses lift-core 0.8.

I'm not 100% on how it chooses the archetype version from the normal
selection menu but it would be nice to get something relatively more
up to date.

Sorry if this is discussed elsewhere.


On Dec 1, 8:28 am, Indrajit Raychaudhuri <indraj...@gmail.com> wrote:
> Friends,
>
> Following the recent refactoring that the Lift archetypes went though,

> we have moved forward to the newarchetypemetadata format [1] for all


> the archetypes.
>
> So far, the JPA related archetypes were using the new metadata format
> while the others (esp. lift-archetype-blank and lift-archetype-basic)
> were still on the old format. Moving to the new metadata format helps
> us keep things consistent, comply with Maven's recommendation and open
> the archetypes up for additional future enhancements.
>

> From now on, the recommended Maven goal togenerateprojects fromarchetypeis to use "archetype:generate" [2]. The currently deprecated


> Maven goal "archetype:create" [3] would not work to give expected
> result and thus is not recommended anymore.
>

> Therefore, togenerateproject from the archetypes in the master you


> would use a command of the form:
>

> mvnarchetype:generate\


>   -DarchetypeRepository=http://scala-tools.org/repo-snapshots\
>   -DremoteRepositories=http://scala-tools.org/repo-snapshots\
>   -DarchetypeGroupId=net.liftweb \
>   -DarchetypeArtifactId=lift-archetype-blank \
>   -DarchetypeVersion=1.1-SNAPSHOT \
>   -DgroupId=com.mypackage \
>   -DartifactId=myproject \
>   -Dversion=1.0-SNAPSHOT
>
> Currently, the possible archetypeArtifactId are:
>   - lift-archetype-blank
>   - lift-archetype-basic
>   - lift-archetype-jpa-blank-single
>   - lift-archetype-jpa-blank
>   - lift-archetype-jpa-basic
>
> If you create project interactively (default behavior), -DgroupId, -
> DartifactId, -Dversion are optional. Maven would prompt for these
> values (and some more) interactively.
>
> On the other hand, if you are using a batch/shell script togenerate
> project non-interactively, you would need to add at least -DgroupId, -
> DartifactId and additionally set -DinteractiveMode=false.
>
> Cheers, Indrajit
>
> References:

> [1]http://maven.apache.org/plugins/maven-archetype-plugin/specification/...
> [2]http://maven.apache.org/plugins/maven-archetype-plugin/generate-mojo....
> [3]http://maven.apache.org/plugins/maven-archetype-plugin/create-mojo.html

Indrajit Raychaudhuri

unread,
Dec 28, 2009, 1:19:31 AM12/28/09
to lif...@googlegroups.com
Hello Joseph,

Archetype list is picked up from the archetype catalog [1]. This is
controlled by the parameter 'archetypeCatalog' when you invoke the goal
'archetype:generate' (defaults to 'internal,local') [2].

Thus, what you see by default is the internal list that is picked up
from archetype-catalog.xml that is bundled internally. That catalog is
an old one.

The only way to have archetype:generate pick up new catalog is to
specify one via -DarchetypeCatalog. For example, "mvn archetype:generate
-DarchetypeCatalog=http://scala-tools.org/" should show you the new list.

That said, we don't have the new catalog of archetypes deployed on
http://scala-tools.org/archetype-catalog.xml. Please raise a ticket for
this.

Till then, the longer version of archetype:generate (with
'-DarchetypeRepository=... -DremoteRepositories=...' etc.) works best.

[1]
http://maven.apache.org/plugins/maven-archetype-plugin/specification/archetype-catalog.html
[2]
http://maven.apache.org/plugins/maven-archetype-plugin/generate-mojo.html#archetypeCatalog

Cheers, Indrajit

> --
>
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages