- standard Maven 2 distribution contains 5 archetypes: "archetype", "j2ee-simple", "mojo", "quickstart", "site", "webapp";
- AppFuse 2.0 project (http://appfuse.org) now is rewritten in form of different archetypes (8): "basic-jsf", "basic-spring", "basic-struts", "basic-tapestry", "modular-jsf", "modular-spring", "modular-struts", "modular-tapestry";
- WebTide site (http://www.webtide.com/resources.jsp) published archetypes for web development (10): "ActiveMQ", "DOJO", "DWR", "JSF", "SiteMesh", "Spring", "SpringJpa", "Struts", "Tapestry", "WebWork";
- JPA 101 (http://jroller.com/page/cmaki?entry=jpa_maven_2_archetype) archetype ("hibernate-archetype").
I wrote simple front-end with the help of Swing and Beanshell that displays all input parameters for the project (group ID, artifact ID, version and arche-type). After selecting appropriate archetype and clicking on "Create archetype" button, new project will be created in the current directory.
The source for this script is located here: create-archetype.bsh.
This program uses behind the scene Scriptlandia API to execute maven2 tool:
ScriptlandiaHelper.executeMaven(args);
After this work is done, it's easy to create simple starters for different archetype implementations.
For starting standard maven 2 archetypes:
// maven-archetype.bsh
sourceRelative("create-archetype.bsh");
String[] archetypes = {
"archetype", "j2ee-simple", "mojo", "quickstart", "site", "webapp"
};
CreateArchetype frame = new CreateArchetype("WebTide");
frame.setArchetypes(archetypes);
frame.setArchetypeGroupId("org.apache.maven.archetypes");
frame.setArchetypeArtifactIdPrefix("maven-archetype-");
frame.setArchetypeVersion("1.0");
frame.setVisible(true);
For starting AppFuse archetypes:
// appfuse-archetype.bsh
sourceRelative("create-archetype.bsh");
String[] archetypes = {
"basic-jsf", "basic-spring", "basic-struts", "basic-tapestry",
"modular-jsf", "modular-spring", "modular-struts", "modular-tapestry"
};
CreateArchetype frame = new CreateArchetype("Appfuse");
frame.setArchetypes(archetypes);
frame.setArchetypeGroupId("org.appfuse");
frame.setArchetypeArtifactIdPrefix("appfuse-");
frame.setArchetypeVersion("1.0-m3");
frame.setRemoteRepositories("http://static.appfuse.org/repository");
frame.setVisible(true);
For starting WebTide archetypes:
// webtide-archetype.bsh
// Resource: http://www.webtide.com/resources.jsp
sourceRelative("create-archetype.bsh");
String[] archetypes = {
"ActiveMQ", "DOJO", "DWR", "JSF", "SiteMesh", "Spring", "SpringJpa", "Struts", "Tapestry", "WebWork"
};
CreateArchetype frame = new CreateArchetype("WebTide");
frame.setArchetypes(archetypes);
frame.setArchetypeGroupId("com.webtide");
frame.setArchetypeArtifactIdPrefix("maven-archetype-");
frame.setArchetypeVersion("1.0");
frame.setRemoteRepositories("http://scriptlandia-repository.googlecode.com/svn/trunk/tools");
frame.setVisible(true);
For starting Jpa 101 archetype:
// jpa-archetype.bsh
// Resource: http://jroller.com/page/cmaki?entry=jpa_maven_2_archetype
sourceRelative("create-archetype.bsh");
String[] archetypes = {
"hibernate-archetype"
};
CreateArchetype frame = new CreateArchetype("JPA");
frame.setArchetypes(archetypes);
frame.setArchetypeGroupId("com.sourcebeat");
frame.setArchetypeArtifactIdPrefix("jpa-");
frame.setArchetypeVersion("1.0-SNAPSHOT");
frame.setRemoteRepositories("http://scriptlandia-repository.googlecode.com/svn/trunk/tools");
frame.setVisible(true);
166 comments:
Post a Comment