The first more practical approach is to create, or use an existing application, and convert it to an archetype.
- Create a new Maven web project in NetBeans.
- Modify the
pom.xml
to include the dependencies you require in the project. - (Optional) Modify the
pom.xml
to include a license - (Optional) Create a
web.xml
. This is not required for JEE6 web application generally. However, we need one for the Faces Servlet. - (Optional) Add a resource file for externalizing message resources
- Create a basic web page, and supporting classes. JSF for example has the following.
Index.xhtml
IndexBean.java
is a Java EE 6 JSF@ManagedBean
, and@RequestScoped
bean. You could use@Named
and@RequstScoped
from CDI as well.
- Once you are satisfied withe the project, execute
mvn archetype:create-from-project
. This will create your new archetype in thetarget/generated-sources/
directory. - Open the newly created project in NetBeans and make any necessary changes.
- Next execute
mvn install
. This will install your new archetype in the local repository. - Create a new project using the new archetype, and run it.
I have created a Youtube video that demonstrates the process.
1 comments :
thank you, very good post!!
Post a Comment