views:

66

answers:

2

Hello, i want to create a Maven project in eclipse. I have install the m2eclipse plugin in my eclipse, i have create a new Maven Project, now i'm stuck with archetype, i want to create a project with Struts 2, Hibernate 3, MySql and JUnit

A: 

About the same answer as here.

Colin Hebert
+1  A: 

You shouldn't expect to find an archetype for all possible combinations, they are endless and I generally prefer to shape my own project myself, starting with basic archetypes (you can bootstrap a project using some archetypes, just don't expect to always find an ultimate generic solution).

In your case, you could either use the Struts 2 Blank Archetype for the presentation part:

mvn archetype:generate -B \
                       -DgroupId=tutorial \
                       -DartifactId=tutorial \
                       -DarchetypeGroupId=org.apache.struts \
                       -DarchetypeArtifactId=struts2-archetype-blank \
                       -DarchetypeVersion=2.1.8.1

And then the JPA archetype (hibernate based) for the domain part:

mvn archetype:generate -B \
                       -DgroupId=com.my-company.my-project \
                       -DartifactId=my-project-domain \
                       -DpackageName=com.company.project.domain \
                       -DarchetypeGroupId=com.rfc.maven.archetypes \
                       -DarchetypeArtifactId=jpa-maven-archetype  \
                       -DremoteRepositories=http://maven.rodcoffin.com/repo \
                       -DarchetypeVersion=1.0.0

Or use the AppFuse QuickStart archetype:

mvn archetype:generate -B \
                       -DarchetypeGroupId=org.appfuse.archetypes \
                       -DarchetypeArtifactId=appfuse-basic-struts-archetype \
                       -DarchetypeVersion=2.1.0-M1 \
                       -DgroupId=com.mycompany -DartifactId=myproject

And remove all the appfuse specifc stuff (seems to be more work than going the other way i.e. adding stuff).


Or simply create a blank webapp and add the required stuff yourself. Often, this is the best thing to do as already hinted.

Resources

Pascal Thivent