Prep: make sure indices for local and Central repos are available. Run through all steps in advance so all dependencies are in local repo (makes things run faster and work better if network goes down), but delete ~/.m2/repository/org/duelengine/duel-runtime/0.6.0/duel-runtime-0.6.0-{sources,javadoc}.jar.

File > New Project > Maven. Explain that NB provides a few basic templates for empty projects, such as Web Application, but you can also work with many other technologies. Select Project from Archetype, click Next and expand Archetypes from Remote Repositories, select DUEL MVC Archetype (0.3.3), accept defaults on Name and Location panel, Finish.

Show Output Window where project is being created and soon opened. Will initially have some errors in Source Packages; click Build Project and show that Generated Sources (duel) appears, after which errors should disappear. RESTful Web Services should be shown too. Expand Dependencies and hover over nodes, showing tool tips; also right-click project root node and click Show Dependency Graph (zoom in a bit if needed), close.

Under the project's main source package, open AppContext.java in editor and get code completion on LinkInterceptor in import block. Should initially show no Javadoc, but click Attach Javadoc link and the docs should display. Ctrl-Click the class name in the editor and you will get "Showing generated source file"; click Attach Sources... and the editor should be replaced by the actual library source.

Add a line to the constructor (after the call to super):


"LogFactory" should be marked with an error line. Accept the first Alt-ENTER hint to "Search Dependency..." and pick commons-logging:commons-logging:1.1.1. Show the new node under Dependencies. Now accept the hint to "Add import..." and the error badges should clear. Note that Javadoc is now available on Log.info as well. Close editor.

Place caret on LogFactory, Edit > Find Usages. Besides the project usage just added, usages in the Maven repo are shown; expand commons-validator > commons-validator > 1.2.0 and double-click FormSetFactory to see examples of Commons Logging usage from another project.

File > Project Properties, select each panel in turn to show what can be customized from the GUI; Cancel. Under Project Files, open pom.xml. (Can show in Files tab that there are no NetBeans-specific files.) Pick a <dependency> and in the <version> field, press Ctrl-SPACE and show that available versions in the Maven repository are available. Also show Window > Other > Maven Repository Browser, click the Find button, enter "duel", show that similar information is available there. Going back to pom.xml, press Alt-INSERT and select Plugin; search on "html-to-pdf", pick org.apache.camel:maven-html-to-pdf:2.8.2, click OK; under <configuration>, delete placeholder text, type '<', and press Ctrl-SPACE to see a list of plugin parameters such as "styleSheets" with their documentation. Delete the new <plugin>.

Press F6 to run and select an app server to run the project with, e.g. GF 3.1. The web browser should open with the root URL of the app. Add "ping" to the URL and see that the response is "pong". Shut down Glassfish (Stop button in Output Window).

Open pom.xml and insert plugin; search on "jetty" and pick org.mortbay.jetty:maven-jetty-plugin:6.1.26. Under Project Properties > Actions, select Run Project; in Execute Goals, replace "package" with "jetty:run" (note that completion is offered for plugins with standard prefixes); clear text under Set Properties; click OK. Now press Run Project, wait for Output Window to say Jetty is ready, and open http://localhost:8080/ to see app deployment even without IDE support.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo