This page shows features of Maven Integration for Eclipse in a form of the demo script that you can read trough and can try for yourself.
Prereqs
See Installation Requirements section
Maven preferences, console, navigation and other stuff
- Show Maven preferences page under Window / Preferences... / Maven
- Show Maven Console
- Open Console view (Window / Show View / Console, or Alt-Shift-Q, C)
- Open Maven console from Console view toolbar
- Open Progress view (to show downloading progress)
- Show POM search (Navigate / Open Maven POM)
- Type "lucene", select "lucene-core" and then version 2.3
- Click OK and show the pom
- Show Open Type from Maven (Navigate / Show Open Type from Maven)
- Type "applicationcontext", expand AbstractApplicationContext node
- Select version 2.5.1, click OK to show the Java source (show that outline view works as well as quick outline Ctrl-Q)
- Show "Maven Version Decorator" (Window / Preferences... / General / Appearance / Label Decorations / Maven Version Decorator)
Creating new projects
- Open "File / New..." wizard. (Ctrl-N or Alt-Shift-N)
Select "Maven Project" (can also type "maven" in quick filter)
New Maven Project wizard fill appear.
- Leave first page with all defaults
create simple project (unchecked)
use default workspace location (checked)
click Next
On the Archetype selection page show quick filter
type "appfuse" then "groovy" then "quickstart" to show quick filtering
select maven-archetype-quickstart
click Next
On archetype parameters page specify groupId, artifactId and version
use org.sonatype.demo:demoapp:1.0.0-SNAPSHOT
click Finish
New project "demoapp" will be created
- Open "demoapp" project in the "Package Explorer" view
Show "Maven Dependencies" container and its contents "junit-3.8.1.jar"
Open project's pom.xml and change junit version to 3.8.2
Show that jar inside "Maven Dependencies" container been updated
Show "Maven" popup menu- Explain "Update Dependencies" and "Update Source Folders" actions in there
- Check if junit jar have sources attached, if not, kick "Download Sources" action from "Maven" popup menu
- Show Maven Indexes view (Window / Show View / Other... / Maven Indexes)
Show browsing trough central index and opening poms
Reindexing of local Maven repository
Updating index from Central
Show searching dependencies
- Call "Add dependency" action from "Maven" popup menu on the project node
Type "plexus" as query
Find "org.codehaus.plexus - plexus-utils" in the list and expand it
Select version that has sources (icon decoration), i.e. 1.4.8
Click OK
Show that plexus-utils been added to the "Maven Dependencies" container
Check if its sources been downloaded
Show Maven launch configuration
- Select demoapp project
From popup menu select "Runs as... / Maven test" (or install)
Show maven execution and successful tests
From popup menu select "Run as... / Maven build..."- Launch configuration dialog will appear
- Click on "Select" button next to the "Goals" entry field
- Type "help" in the quick filter field and then select "effective-pom" goal from the list (can uncheck "Use Qualified Name" checkbox). Click Ok
- help:effective-pom will be inserted into the "Goals" field.
- Click "Run" on launch configuration dialog and show the output
- Can repeat the same with dependency:tree plugin but using qualified name
Materializing existing projects
- Select plexus-utils jar in the demoapp project created above
From "Maven" popup menu invoke "Import Project"
Materialize project wizard will be shown and you can click Finish
Show that project is checked out from SVN
Show that entry in "Maven Dependencies" container in demoapp project been replaced from jar to the project reference
Open properties for the "Maven Dependencies" container
Explain configuration for profies and workspace resolution
Disable workspace resolution in properties and click ok. Show that plexus-utils jar is used again, then enable workspace resolution back
Close plexus-utils project (from popup menu). Demoapp project should refresh automatically, but if not, kick "Update Dependecnies" action from "Maven" popup menu on demoapp project
Reopen plexus-utils project. Show that entry in "Maven Dependencies" been replaced with the project link
- Open "File / Import... / Materialize Maven Projects" wizard
On project selection page click "Add"
In the artifact search dialog type "org.apache.maven" as query
Then expand "maven" project node in the results (first entry)
Select 2.0.8 version and click OK.
Expand "Advanced" section on project selection page
Select from the drop down or type in "[artifactId]-[version]" in "Name Template" field
Click Finish
Project will be checked out from SVN (if you'll have connection), configured and built without any errors.
Show all "maven-*-2.0.8 projects created in workspace
Open maven-core-2.0.8 project and show that it has references to other maven-*-2.0.8 projects in "Maven Dependencies" container
- Open "SVN Repositories" view (Window / Show View / Other... / SVN / SVN Repositories)
- It should already have entry for Apache SVN repository
- If not, create one using https://svn.apache.org/repos/asf url
Expand Apache svn repository up to "/maven/components/trunk" node
From popup menu select "Check out as Maven Project..."
Leave "checkout all projects" checked
Expand "Advanced" section
Specify "[artifactId]-2.1.x" in the "Name Template" field
Click Finish
Show that different set of projects been created in the workspace and they are also properly linked together
- Same "Checkout Maven project from SVN" wizard can be also invoked from "File / Import... / Checkout Maven project from SVN"
Show "Browse" button allows to select location from svn, or you can paste url or select it from the dropdown list
Integration with Mylyn
- Pre-create Task Repository for Codehaus JIRA
Open Mylyn "Task Repositories" view (Window / Show View / Other... / Mylyn / Task Repositories)
Add new task repository (from toolbar action or from popup menu)
Select JIRA connector and click Next
Select "Codehaus" from popup menu, or manually enter server url as http://jira.codehaus.org/ and label as "Codehaus". Specify your credentials for codehaus JIRA repository
After creating new repository Mylyn will offer to create new query, you can ignore that,
Select Codehaus repository and from popup menu kick "Update Attributes" action
Because there are lots of project this operation may take 5..10 minutes time and it will be good to do that in advance
- Now we can go back to our "maven-*-*" projects, open project properties from the popup menu on any of them or on "plexus-utils" and see that Codehaus repository is preselected in "Task Repository" panel.
Selecting those projects you can invoke "New" wizard, Ctrl-N or Alt-Shift-N, then select "New Task" and see that "Codehaus" repository is preselected on project selection page of the New Task wizard.