You are on page 1of 124

Edition 1.

0

m2eclipse 0.10.0

Maven Integration for Eclipse

Developing with Eclipse and Maven
Tim O’Brien Jason van Zyl Benjamin Bentmann Igor Fedorenko Brian Fox Milos Kleint Peter Lynch Matthew Piggott Pascal Rapicault Rich Seddon Vlad Tatavu Dan Yocum

A Sonatype Open Book Mountain View, CA

Copyright © 2010 Sonatype, Inc. This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States license. For more information about this license, see http://creativecommons.org/licenses/by-nc-nd/3.0/us/. You are free to share, copy, distribute, display, and perform the work under the following conditions: • You must attribute the work to Sonatype, Inc. with a link to http://www.sonatype.com. • You may not use this work for commercial purposes. • You may not alter, transform, or build upon this work. Nexus™, Nexus Professional™, and all Nexus-related logos are trademarks or registered trademarks of Sonatype, Inc., in the United States and other countries. Java™ and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries. IBM® and WebSphere® are trademarks or registered trademarks of International Business Machines, Inc., in the United States and other countries. Eclipse™ is a trademark of the Eclipse Foundation, Inc., in the United States and other countries. Apache and the Apache feather logo are trademarks of The Apache Software Foundation. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Sonatype, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. Published by: Sonatype, Inc. 800 W. El Camino Real Suite 400 Mountain View, CA 94040. For online information and ordering of this and other Sonatype books, please visit www.sonatype.com. The publisher o ers discounts on this book when ordered in quantity. For more information, please contact: book@sonatype.com

ISBN 978-0-9842433-1-0

Editor: Tim O’Brien

.

.

...................................................4........................... 31 6....................................................................................................1........................3.....................................................4...........................6 (Helios) with the Eclipse Marketplace .........................................1 .......................... Installing m2eclipse Extras .............................. 8 2.................. 43 7.................................................................................... 37 6. Materializing a Maven Project ................................................ Browsing Your Local Repository ... 24 3...................................................................................................................................4.... 45 7....................................................... Browsing Your Workspace Repository ............................................... 18 3........................................................... Installing m2eclipse in Eclipse 3................... Creating a Maven Project from a Maven Archetype ............................................................................................................................................... Opening Project Pages .................... Create a Maven POM File .................. 3 1..................3.......................... Browsing a Project Repository ................................................................................................................................................................................... Working with Maven Projects .........3.....................3......................... Creating and Importing Projects ......... Installing Maven Integration for Eclipse (Extras) Prerequisites .................................................. 39 6....3..............4.................... Working with Maven Repositories ................. 12 2............................6............................................................... 35 6............ 17 3..................................................................3......4...... 35 6.... Installing m2eclipse ................................ 40 6..................... Browsing and Manipulating Maven Repositories ... 29 4..............................................................................1....................... m2eclipse Preferences ..................................1..................................................1.......................................................... Uninstalling m2eclipse from Eclipse 3.................2......................................... 17 3......................2.............................1............0 ........................................1 ............ 29 4...................................................................3.................................................................. Browsing Global Repositories ................................ Using m2eclipse .......................................................... 43 6....................................1.................... m2eclipse .............................................................................................................................................1............ 51 8.......................... 51 ...................................................................................................................................................4........................1..........................................3.........................................4......... Installing Optional Prerequisites .......... 47 8............................ Searching For Maven Artifacts and Java classes .............. Importing Maven Projects ......................................... 3 1..5................. Downloading Source ...........................1..........................1.................................................... Installing Maven Integration for Eclipse (Extras) .......... 11 2.........2........ 40 6..... 46 7........................ Installing m2eclipse Core Components . Creating a Maven Module ........... 11 2............................ Analyzing Project Dependencies in m2eclipse . 22 3........................................4....................1...................... 5 2................................2.... Importing a Maven Project .......................... 35 6.... 9 2.................................... 1 1...... Introduction to m2eclipse ........................................... Installing m2eclipse in Eclipse 3..............2...............................1...................................1...............................4.........5 (Gallileo) ................6 (Helios) with the Eclipse Marketplace ........... Installing Maven Integration for Eclipse (Core) ............................................2........................................................... 45 7................................................................................................................................................................ Indexing Maven Repositories ..........................2.............................. 29 5.......................... Working with Maven Repositories ................................................................ 6 2................................................................2.1...3..... Running Maven Builds ........................................................... .. 41 6...........................1................................1............. 46 7........3.................................................................................................2............................... 13 3............................................. Manipulating a Repository Index .............................. 38 6...................... ix 1.................................................................................................2..... Maven Preferences ......1.......1........3........ Installing the Eclipse IDE ..2............................................. Changes in Edition 1............... ix I............. Sonatype m2eclipse ......................... Creating a Maven Project ........ Using m2eclipse ....2.......................1...........................Copyright ................................ 5 2.......................... 45 7..................... 31 5.................................................3.................................... Running Maven Builds ......................................................... Changes in Edition 1....................................................................................................................................3..... 20 3........................................... vii Foreword: 1.2......................................................... ix 2.................................................................1.................... Opening the Maven Repository View ........................................................................................... 17 3............................ 12 2............................................................ Enabling the Maven Console ................. Introduction .....1......2................................................... 25 4............ 5 2................. 23 3............... Checking Out a Maven Project from SCM ......................................4.............. Adding and Updating Dependencies and Plugins .................... 46 7....2......................... 3 2........... Resolving Dependencies .......................

...............6................. Advantages of a Low-risk Development Environment .. Run the MSE Installer ...................................................5.......1................................ Managing Change in Development Environments ............................ 10..............3...........................................3............................................................. 10..................4................... What is a Source Tree? ....................................... 10........ Disadvantages of a High-Risk Development Environment ....................... Summary ................................................6....... Resolving Dependencies ............................3......................... Verify P2 Lineups are Published ........................................... 10.............................. 10..................4.............................................................................................. Maven Studio for Eclipse ........................... 52 52 52 52 56 57 59 59 59 59 61 61 62 63 63 64 65 66 66 69 69 69 69 70 70 70 70 71 71 71 71 71 71 71 72 72 72 72 72 73 73 73 73 74 74 74 74 74 75 75 76 76 77 iv ..............................................2.......2.... Introduction to Maven Studio for Eclipse ..........................................................1........ 10.....5............1................ Execute a Scheduled Task for P2 Lineups ..........................2......................1.............................. Materialize a Sample Workspace ............................ 9........................1............................3................................................. Installing Nexus Team Edition ........ Downloading Source ......................................... 9....................... II................... Unpack Nexus Team Edition .............................4................................. 10.............4............................................ Configure Nexus Team Server ...... 10........... 10..............6..........................................3.................................................................. 10...... 9.......................2......8..............2.................1............3.............2.................................................. 10................................... 10.....1.... 10...............................1...................................................... 8............ 10..................................... 10.................................... 10..................................................... 9. Managing Developer Workspace Complexity .................................... 10.. 9.......................2............................... Configure the New Proxy Repository ..............................................................6......................6...............................................3.......................................................5.............................1............... 10.................. Run the Publish Lineups Scheduled Task in Nexus Team Server .................................3...............5........ 8...... 10...................6...............................................................................................................2...................................... Configure Password Recovery ........1........................ Getting Started with Maven Studio for Eclipse .................................... Click on the MSE Installer for the Maven Lineup .......................................1....4....6........3............. 10.....6......4............6................................................................................................ The Cost of New Developer Onboarding ............................................................ Simple Scenario: Aggregating a Project's Feeds ......................................... Opening Project Pages ..... 9....................................................................................................2.5....... The Common Scenario: Upgrading Development Infrastructure .... 8......... 10.................................................................... 10...... Onboarding with Maven Studio for Eclipse: Productive on Day One ..........2.......... Workstation Prerequisites ..7........ 10............ Maven Studio for Eclipse Quickstart ..... Open the Repositories Panel ........... Login as a Nexus Administrator ..........................1....................................... What is a Lineup? .... Consolidating Project Feeds ................................................................1.................................................. What is a Source Tree Root? .......................................................................... What is a Codebase? ...........................................................4........................................ 8......... 9............ Select Nexus Managed Repositories ................. Introduction ...................1..............3...................................8..................................................................................... 9............ Download Nexus Team Edition ............. 10... 10.........3............. Verify Completed Eclipse Installation .... Supply Server and Source Control Credentials ............................................................................ Open the Nexus Server Configuration Panel ..........................................4.......................4................. Start Nexus Team Edition ..................1........................3.............. Nexus Team Edition Prerequisites ................................ Configure Proxy Settings ............... 10..2......................................... Developer Onboarding ...2.........2....................................1............. 9...................................................................... 10.......................... Save the Nexus Server Configuration .............................1..1...............................................................................................................................3.............2...........2........................................................3................................................. Select Sonatype MSE Repository ................................................ 9.................................... 9..............2................................................... Introduction .............4..................................9......................2............3..3.................................... 10.............4.....1................................ 10.... 10.......4.............................................................................. 9....4........... 10.............5............... Use Case for a Build Engineer ......... 9........... Complex Scenarios: Mixed Open/Commercial Development ................................3......... Specify Installation Directories ... Add a New P2 Proxy Repository .......1....... 10......... Using the Form-based POM Editor .....................2....................................6........6.................... 10......................... 10........

............ Creating a New P2 Lineup ....................................................7..............2..................... 92 11...........................9.... Add the Checkstyle Plugin Installable Unit .9...4..................................1............................ Create a New Source Tree .. 87 10..........3. Configure Materialization Directories . Reset Subversion Connection ....... Creative Commons BY-NC-ND 3...................................... 95 11.. 83 10..................4........................ Create a New MSE Lineup Project .....................9............................ Managing Codebase Source Trees ...........3.8.......... Supply Nexus Team URL and Credentials ...............3................ Supply Nexus Credentials .................... Troubleshooting Codebase Materialization .. Download the Codebase Installer ......7...................................................................3..........................................2................. Configure Nexus and Lineup Coordinates ..2..........................................7 .................................... Configuring a MSE Codebase ............................................................1...... 97 11.... Configure the SCM Location .....................10...... 87 10.... 107 B.......................... 100 11...................................................... 98 11.................................................4.................................... Managing MSE Codebases and P2 Lineups ...8 .............................................................................. 88 10. Configuring Codebase Information ..........................2.................0 US License ............................ Book Revision History ........................10...................... 85 10...........5........................................................4....................8........................ 100 A.................................................. 96 11................................ 82 10.........7.....10. 78 10..........6 ..... Publish the Codebase ....................... Creating a New MSE Lineup ................. Configuring Codebase Security ................................ 85 10................ 89 11........................ 80 10.............. 100 11.. Configure the New Source Tree .................. Add a Feed URL ....................... 88 11..... Setting Codebase Prerequisites ...... Maximize the Codebase Overview ...............................................................................................................................7................................... Publish Your Codebase to Nexus .......................................................................... Creating a MSE Codebase .....................................................9..9.......7............................................................................. 84 10..... 109 v ...................................... Introduction ............................................................... 86 10.................................1................................................ 89 11......................1................................2.................... 98 11...2................................ 107 B.......................5............................................................ 96 11.....1........................................... 84 10........................................................................................... Publishing Maven Settings .1............................................ Publishing a Codebase .................. Publishing an MSE Codebase to Nexus Team Edition .................................5.............. Creating a New MSE Codebase ..................................................... Changes in Edition 0.10........................1................................................. Creative Commons License ................8...1....2...10........................1..................................................2............................. 83 10... Adding a New Feed URL .....10.............................................. 89 11. 107 B...................................................................................................9................................................................7........2................................. 97 11...... 92 11............7...............................................11... Managing Codebase Resource Locations ............................ 83 10................................................................................................................9............................... Configuring a Source Tree ........ Verify the P2 Lineup .......................5.....................................................................................................8........ 79 10.................... Supply Apache Subversion Credentials .......................... 107 Index .......... 103 A..................8................ 103 B...................... 80 10................................3......... Use Your Materialized Eclipse Installation .......... 84 10................................. Publishing Eclipse Preferences ...1........ Select the New P2 Lineup Wizard .........................................................10...........2.................................................................................................................... 78 10.. Changes in Edition 0....2............ Configure the Contents of the Lineup ...........................7.......... Configuring a New Codebase ..............................6............................ 86 10...............................................5............................................................................................................................................................................ 79 10.............................................. 81 10...............3.............................................................................................................................. 89 11.6........................................ Materializing a Codebase ........................ 82 10............................................................. 94 11......................8...................................................................................................................................... 85 10.............................................. 81 10........................7................................................8...........11...................................................7.1............................................................................................................................................... 85 10............... Changes in Edition 0................ Adding a Maven Profile ....................................... Select Runtime Platform and Memory ..........8.........................10..... Add a New Repository .................5.. 81 10..........................................................7...................................................................................

.

. in the United States and other countries. Mountain View. Suite 400. Inc. Inc. 800 W. or for damages resulting from the use of the information contained herein. the publisher and authors assume no responsibility for errors or omissions. the designations have been printed in caps or initial caps. Java™ and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems. While every precaution has been taken in the preparation of this book. IBM® and WebSphere® are trademarks or registered trademarks of International Business Machines. El Camino Real. was aware of a trademark claim.Copyright Copyright © 2010 Sonatype. and all Nexus-related logos are trademarks or registered trademarks of Sonatype. Inc. Apache and the Apache feather logo are trademarks of The Apache Software Foundation.. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Nexus™. 94040. in the United States and other countries. in the United States and other countries. Inc. CA. Inc. Eclipse™ is a trademark of the Eclipse Foundation.org/licenses/by-nc-nd/3. and Sonatype. . Inc. see http://creativecommons. Nexus Professional™. Where those designations appear in this book. This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3. Online version published by Sonatype.. in the United States and other countries.0 United States license. Inc.. For more information about this license.0/us/..

.

Managing MSE Codebases and P2 Lineups 1 mailto:book@sonatype. Tim O'Brien.com .Foreword: 1. Sonatype July.com/m2eclipse-book weekly for any updates to the content.6 (Helios) with the Eclipse Marketplace” 2. Maven Studio for Eclipse Quickstart • Chapter 11.com1.1 1. “Installing m2eclipse in Eclipse 3. • Added Maven Studio for Eclipse chapters to the book. Introduction to Maven Studio for Eclipse • Chapter 10. Changes in Edition 1. We welcome your feedback. please do not hesitate to contact the Sonatype team with any questions or ideas you may have about the product. Changes in Edition 1. and we will gladly add your email to the update notification list. • Chapter 9.1 in July.sonatype. If you would like to receive updates whenever there is a change to this user's manual.1 You are encouraged to check http://books.0 The following changes were introduced in Edition 1.1 The following changes were introduced in Edition 1.2. please send a quick note to book@sonatype. 2010: • Added Section 2. 2010 Edition: 1.0 in June 2010: • Added a new part to the book on Maven Studio for Eclipse.

.

Part I. Sonatype m2eclipse The first portion of this book deals with the Sonatype m2eclipse plugin. .

.

Chapter 1. Just a few of the features m2eclipse provides include: • Creating and importing Maven projects • Dependency management and integration with the Eclipse classpath • Automatic dependency downloads and updates • Artifact Javadoc and source resolution • Creating projects with Maven Archetypes • Browsing and searching remote Maven repositories • POM management with automatic update to dependency list • Materializing a project from a Maven POM • Checking out a Maven project from several SCM repositories • Adapting nested multi-module Maven projects to the Eclipse IDE • Integration with Web Tools Project (WTP) • Integration with Subclipse • Integration with Mylyn • Form-based POM Editor • Graphical Display of Dependency Graph • GUI Presentation of Dependency Tree and Resolved Dependencies There are many more features in m2eclipse beyond the list above and this chapter introduces some of the more impressive features that are currently available. Eclipse has a huge amount of plugins (see http:// www. 1. m2eclipse The m2eclipse plugin (http://m2eclipse. and the Mylyn plugin provides the m2eclipse plugin with the ability to interact with a task-focused interface that can keep track of development context. The m2eclipse1 project. Eclipse is ubiquitous. 1 http://m2eclipse.org/mylyn/).1. Introduction The Eclipse IDE is the most widely used IDE for Java development today.com/) and an innumerable amount of organizations developing their own software on top of it. Introduction to m2eclipse 1. in this chapter. Quite simply. The Subclipse plugin provides the m2eclipse plugin with the ability to interact with Subversion repositories. provides support for Maven within the Eclipse IDE. Let’s get started by installing the m2Eclipse plugin.2.codehaus.org/) and the Mylyn plugin (http://www. we will explore the features it provides to help you use Maven with Eclipse.eclipseplugincentral. m2eclipse also has hooks into the features of both the Subclipse plugin (http://subclipse.org/ .org/) provides Maven integration for Eclipse.eclipse.tigris.sonatype. and.

.

6 (Helios) with the Eclipse Marketplace The Eclipse Marketplace makes it easy to install m2eclipse and m2eclipse (Extras) in Eclipse 3. and to make use of m2eclipse you will need to install the JDK. 2. Installing m2eclipse 2.5 or Eclipse 3.for more information about installing the Eclipse IDE..1. Installing m2eclipse in Eclipse 3. Opening the Eclipse Marketplace The first time you open the Eclipse Marketplace.org/downloads/ in a web browser. To open the Eclipse Marketplace. as shown in Figure 2.2. Install Eclipse .eclipse. Installing the Eclipse IDE Sonatype recommends installing m2eclipse on Eclipse 3. Download an Eclipse distribution. Figure 2.2. Go to http://www. download the Eclipse IDE for JavaEE Developers distribution. go to the Eclipse Help menu and select Eclipse Marketplace.6 (Helios).6. you will be asked to select a Marketplace. 2..Chapter 2. see the Eclipse Wiki1.1. “Opening the Eclipse Marketplace”. 3. “Selecting the Eclipse Marketplace”. Note: If you want to use the m2eclipse WTP integration. To download an Eclipse IDE distribution: 1. Select the Eclipse Marketplace as shown in Figure 2. .1.

3. To install the core component of Maven Integration for Eclipse. Figure 2. “Selecting Maven Integration for Eclipse from Eclipse Marketplace”. Eclipse will download a list of available components from the remote update site and present you with a list of available features in the Maven Integration for Eclipse plugin as shown in Figure 2. select the Search tab. and click on the Finish button. “Selecting Maven Integration for Eclipse from Eclipse Marketplace”. Selecting the Eclipse Marketplace 2. Selecting Maven Integration for Eclipse from Eclipse Marketplace Once you click on Install.2. open the Eclipse Marketplace. Click on the Install button to the right of the second item listed in Figure 2. Installing Maven Integration for Eclipse (Core) Maven Integration for Eclipse is separated into two components: the Core of Maven Integration for Eclipse and an optional package of extra.Figure 2. 6 . unsupported components. “Selecting the Core m2eclipse Feature for Installation”.2.4. required component named "Maven Integration for Eclipse (Required)".3.3.1. Select the single. and search for "Maven Integration" as shown in Figure 2.

7 . If you see the dialog shown in Figure 2. select "I accept the terms of the license agreement" and click on the Finish button. “Agreeing to Software License During m2eclipse Installation”. Figure 2. At this stage of the installation.4. Eclipse will prompt you to either restart or apply changes to a running Eclipse. After a successful restart. Eclipse may warn you that the software you are installing contains "unsigned content". “Ignoring Warning During m2eclipse Installation”. you should click on Restart Now to restart your Eclipse instance.5. Maven Integration for Eclipse is distributed under the Eclipse Public License version 1. Figure 2.5. If you agree with the conditions of this license.Figure 2. Selecting the Core m2eclipse Feature for Installation Eclipse will then ask you to agree to the licenses for Maven Integration for Eclipse in the Review Licenses step shown in Figure 2. click on OK to continue the installation process. Ignoring Warning During m2eclipse Installation Once m2eclipse has been installed. Agreeing to Software License During m2eclipse Installation During the installation process. Maven Integration for Eclipse will be installed.6.6.0.

Figure 2.7. Restarting Eclipse after m2eclipse Installation

2.2.2. Installing Maven Integration for Eclipse (Extras) Prerequisites
The Maven Integration for Eclipse extra components provide support for additional tools like the Web Tools Project (WTP), Subversion integration via Subclipse, and integration with Mylyn. The following sections provide guidance for users installing some of the prerequisites for m2eclipse extra components. 2.2.2.1. Installing Subclipse in the Eclipse Marketplace To install Subclipse in the Eclipse Marketplace, open the Marketplace, select the Search tab, and search for "Subclipse" to see the dialog shown in Figure 2.8, “Selecting Subclipse from the Eclipse Marketplace”. Click on Install next to the Subclipse search result item.

Figure 2.8. Selecting Subclipse from the Eclipse Marketplace

Select the appropriate Subclipse components, agree to the software license for Subclipse, and restart your Eclipse installation after the installation process is completed. 2.2.2.2. Installing Mylyn in the Eclipse Marketplace To install Mylyn in the Eclipse Marketplace, open the Marketplace, select the Search tab, and search for "Mylyn" to see the dialog shown in Figure 2.9, “Selecting Mylyn from the Eclipse Marketplace”. Click on Install next to the Mylyn search result item.

8

Figure 2.9. Selecting Mylyn from the Eclipse Marketplace

Select the appropriate SMylyn components, agree to the software license for Mylyn, and restart you Eclipse installation after the installation process is completed.

2.2.3. Installing Maven Integration for Eclipse (Extras)
To install the extra components for Maven Integration for Eclipse, open the Eclipse Marketplace, select the Search tab, and search for Maven Integration to see the search results shown in Figure 2.10, “Selecting Maven Integration for Eclipse (Extras) from the Eclipse Marketplace”. CLick on Install next to the "Maven Integration for Eclipse (Extras)" search result item.

Figure 2.10. Selecting Maven Integration for Eclipse (Extras) from the Eclipse Marketplace

Once you have clicked on Install, Eclipse will download the list of available plugin components from the remote update site. The list of available components will then be displayed in the Confirm Select Features step as shown in Figure 2.11, “Selecting m2eclipse (Extras) Components to Install”. The components available in the Maven Integration for Eclipse (Extras) site are:

9

M2Eclipse Extensions Development Suppport (Optional) Install this component if you want to develop custom pages in the POM Editor, create custom actions in the Maven popup menu, provide custom templates in the POM XML editor, or make other customizations to m2eclipse. Maven Integration for WTP (Optional) If you are developing applications using the Eclipse Web Tools Project, this component will adapt the Maven classpath container and other Maven resources to the WTP standards. Maven issue tracking configurator for Mylyn 3.x (Optional) Maven can be configured to work with Mylyn a comprehensive issue and time tracking plugin which currently ships with the Eclipse IDE. Maven SCM handler for Subclipse (Optional) Subclipse is a popular Subversion plugin for Eclipse hosted by the Tigris community. If you want to use Maven with Subclipse, this component will provide the necessary integration between the two plugins. Maven SCM handler for Team/CVS (Optional) This component provides integration between the m2eclipse plugin and the CVS support built into Eclipse. Maven SCM Integration (Optional) This component is required if you installed one of the previous plugins (Subclipse or Team/CVS) Project configurators for commonly used maven plugins (temporary) This is a temporary project which contains project configurators for commonly used Maven Plugins.

Figure 2.11. Selecting m2eclipse (Extras) Components to Install

Once you have selected the features you wish to install, click Next. Clicking Next will bring you to the Review Licenses step as shown in Figure 2.12, “Agreeing to Software License During m2eclipse (Extras) Installation”. The m2eclipse Extras is distributed under the Eclipse Public License version 1.0. If you agree to this open source license, select "I accept the terms of the license agreement" and click on "Finish".

10

Figure 2.14. Figure 2. Restarting Eclipse after m2eclipse (Extras) Installation 2. you may receive some warning that "you are installing software that contains unsigned content". To complete the installation of m2eclipse (Extras).5 (Gallileo) 2. Ignoring Warning During m2eclipse (Extras) Installation Once the installation process is finished. Maven Repository integration. “Restarting Eclipse after m2eclipse (Extras) Installation”.3.12. Eclipse will prompt you to apply the changes or restart your Eclipse instance with a dialog shown in Figure 2.14. restart your Eclipse instance. use the following Eclipse update site to install the core of the m2eclipse plugin.org/sites/m2e To install this plugin in the Eclipse IDE: 1. Installing m2eclipse in Eclipse 3. Agreeing to Software License During m2eclipse (Extras) Installation During the installation process for the m2eclipse Extras. If you see the dialog shown in Figure 2. This should display the "Install" dialog. Select Help > Install New Software. Installing m2eclipse Core Components To install m2eclipse. This Core update site contains a single component: "Maven Integration for Eclipse (Required)".3. click OK to continue the installation process. 11 .sonatype. “Ignoring Warning During m2eclipse (Extras) Installation”.Figure 2. and Maven integration: • m2eclipse Plugin: http://m2eclipse.1. the POM Editor. When you install this component you will be installing all of the core Wizards.13.13.

9 to m2eclipse 0. Once the installation process is finished. If you are running m2eclipse 0. the following optional components are available from a separate update site.0.9. Eclipse will then check to see if there are any issues which would prevent a successful installation.9. Eclipse will then resolve all the dependencies for the selected plugins. use the m2eclipse Extras update site. Sonatype strongly recommends that you restart your IDE after installing m2eclipse. Pressing Enter should cause Eclipse to update list of available plugins and components.sonatype.. To install these prerequisites. Paste the Update Site URL into the field named "Work with:" and press Enter.org/sites/m2e-extras 2. In this dialog. In the "Software Updates and Add-ons" dialog. After Eclipse installs new plugins.. This update site contains the following m2eclipse components: • m2eclipse Extras Update Site: http://m2eclipse.3.3.9 you must either uninstall m2eclipse from your Eclipse installation or start with a fresh installation of Eclipse. just add a new remote update site to Eclipse for each of the prerequisite components. you should restart the IDE. Preferences.. and ask you to agree to the plugin license.. Enter the URL of the update site you wish to add and click OK.. or use the m2eclipse Mylyn integration you will need to install the following. which will load the "Software Updates and Add-ons" dialog. 3.3. 12 . 2. Installing m2eclipse Extras In addition to the core m2eclipse components. You can install these prerequisites when you install m2eclipse.2. the available plugins from an update site will appear as soon as the site is added. 4. integrate Maven with the Eclipse Web Tools Project (WTP). Choose the component listed under m2eclipse: "Maven Integration for Eclipse (Required)". Installing Optional Prerequisites Several of the extra components listed in the previous section require third-party plugins to be installed prior to installation. Warning You cannot upgrade from m2eclipse 0. Click Finish to begin the installation process. Install New Software. which will load the simple "Add Site" dialog. select Help. you should see a Maven option in the list of preference categories when you go to Window. Click Next. 5.x • Maven Integration for WTP • M2Eclipse Extensions Development Support To install optional m2eclipse components.2. 6. If you've installed the plugin successfully. You can then select the modules you want to install and click the Install.10. Eclipse will then download and install the necessary components.8 or 0. Eclipse will ask you if you want to restart the IDE.... extra components: • Maven SCM Integration • Maven SCM handler for Team/CVS • Maven SCM handler for Subclipse • Maven issue tracking configurator for Mylyn 3. If you plan to use m2eclipse to materialize projects from Subversion or CVS. button. choose the Available Software panel and click on Add Site.. Click Next and agree to the terms of the Eclipse Public License v1.

5.6.4 • Mylyn Extras (JIRA and Trac Support): http://download. 2.org/mylyn/.6 (Helios). click on the "Uninstall" button next to each item.x client features. 2.tigris. or download a WTP release from http://download.org/tools/mylyn/update/extras For more information about the Mylyn project. see the Web Tools Platform project's web site at http://www.x • Subclipse 1.1.6 (for Subversion 1.x client features. To install Mylyn use the following update sites: • Mylyn (Eclipse 3.3. please see the Subclipse project's web site at http://subclipse. you will need to install Subclipse version 1.3.6 (Helios) with the Eclipse Marketplace To uninstall m2eclipse and m2eclipse (Extras) from Eclipse 3.eclipse. To uninstall either "Maven Integration for Eclipse" or "Maven Integration for Eclipse (Extras)".eclipse.eclipse. see the Mylyn project's web site at http://www.3. If you are using Subversion 1.6. To install Subclipse.6M4): http://download. you will need to install Subclipse version 1.6. you will need to make a decision about Subversion compatibility. Install the "Eclipse IDE for Java EE Developers" from http://www.org/webtools/downloads/. and for more information about the Subclipse plugin. Installing Mylyn To install JIRA or Trac integration with Mylyn. 3.5.eclipse.org/downloads/. Installing Subclipse When you install Subclipse.tigris.eclipse.5 compatibility): http://subclipse. and 3.org/ webtools/.6 compatibility): http://subclipse. Installing the Web Tools Platform (WTP) To install the Web Tools Platform (WTP).x For other versions of Subclipse. 2.3.4. select the Installed tab as shown in Figure 2.3.2.eclipse.2.com/software/jira/ 13 .15. open up the Eclipse Marketplace by selecting Eclipse Marketplace from the Eclipse Help menu.4. Uninstalling m2eclipse from Eclipse 3.atlassian. If you are using Subversion 1. add the Mylyn extras Eclipse update URL. • Subclipse 1.org/update_1.tigris.3. 2 http://www.org/tools/mylyn/update/e3.org/update_1.org/. you'll want to do this if your organization uses Atlassian's JIRA2 for issue tracking. use one of the Eclipse plugin update sites listed below. For more information about the Web Tools Platform. “Selecting Maven Integration for Eclipse Components to Uninstall”. Once you have the Eclipse Marketplace dialog open.4 (for Subversion 1.3.4.4.

16. Select the features to uninstall. and click on Next to continue. Selecting Maven Integration for Eclipse Components to Uninstall If you are uninstalling "Maven Integration for Eclipse". “Selecting Maven Integration for Eclipse (Extras) Features to Uninstall”. and click on "Finish" or "Next". 14 . Selecting Components to Install for Maven Integration for Eclipse Installation If you are uninstalling "Maven Integration for Eclipse (Extras)".16.17. Select the feature to uninstall. “Selecting Components to Install for Maven Integration for Eclipse Installation”. the Eclipse IDE will prompt you to select the features you wish to uninstall as shown in Figure 2. the Eclipse IDE will prompt you to select the feature you wish to uninstall as shown in Figure 2. Figure 2.15.Figure 2.

To complete the uninstallation process. Eclipse will prompt you to either apply changes or restart.18. Figure 2. Restarting Eclipse after Uinstallation 15 . click on "Restart Now". Selecting Maven Integration for Eclipse (Extras) Features to Uninstall Once the uninstallation has successfully completed.17.Figure 2.

.

“Checkout a New Project from Subversion”: .1. project creation takes place via the new project wizard. all three of these options are important to developers using Maven. project creation takes place through the use of a Maven archetype. Figure 3. Creating and Importing Projects 3. “Creating a New Project with m2eclipse Wizards”.1.1. Let’s take a look at each one.Chapter 3. The new project wizard inside of Eclipse offers a plethora of templates for creating new projects. The m2eclipse plugin improves upon this wizard to provide the following additional capabilities: • Checking out a Maven project from a SCM repository • Creating a Maven project using a Maven archetype • Creating a Maven POM file As shown in Figure 3. Creating a New Project with m2eclipse Wizards 3. Creating a Maven Project When using Maven.2. In Eclipse. Simply enter the SCM information for a project and it will check it out for you to a location of your choice as shown in Figure 3.1. Checking Out a Maven Project from SCM m2eclipse provides the ability to check out a project directly from a SCM repository.1.

18 . These features reuse of some of the features in the Subclipse plugin to interact with the Subversion repository.1. Creating a Maven Project from a Maven Archetype m2eclipse offers the ability to create a Maven project using a Maven Archetype. “Creating a New Project with a Maven Archetype”.2. There are many Maven Archetypes provided in the list that comes with m2eclipse as shown in Figure 3.2. Checkout a New Project from Subversion There are additional options in this dialog for specifying a particular revision by browsing the revisions in a Subversion repository or by simply entering the revision number manually. The m2eclipse plugin supports the following SCM providers: • Bazaar • Clearcase • CVS • git • hg • Perforce • Starteam • Subversion • Synergy • Visual SourceSafe 3.Figure 3.3.

Figure 3.3. Creating a New Project with a Maven Archetype

The list of archetypes in Figure 3.3, “Creating a New Project with a Maven Archetype” is a list generated by something called the Nexus Indexer. Nexus is a repository manager which is introduced in "Repository Management with Nexus", a free book available from Sonatype which can be read online here: http://www.sonatype.com/books/nexus-book/reference/1. The Nexus indexer is a file which contains an index of the entire Maven repository, and m2eclipse uses it to list all of the available archetypes in the entire Maven repository. When this chapter was last updated, m2eclipse had approximately ninety archetypes in this Archetype dialog. Highlights of this list include: • Standard Maven Archetypes to create • Maven Plugins • Simple Web Applications • Simple Projects • New Maven Archetypes • Databinder2 Archetypes (data-driven Wicket Applications) under net.databinder • Apache Cocoon3 Archetypes under org.apache.cocoon • Apache Directory Server4 Archetypes under org.apache.directory.server • Apache Geronimo5 Archetypes under org.apache.geronimo.buildsupport • Apache MyFaces6 Archetypes under org.apache.myfaces.buildtools • Apache Tapestry7 Archetypes under org.apache.tapestry • Apache Wicket8 Archetypes under org.apache.wicket
1

???

19

• AppFuse9 Archetypes under org.appfuse.archetypes • Codehaus Cargo10 Archetypes under org.codehaus.cargo • Codehaus Castor11 Archetypes under org.codehaus.castor • Groovy-based Maven Plugin12 Archetypes (deprecated)19 under org.codehaus.mojo.groovy • Jini Archetypes • Mule13 Archetypes under org.mule.tools • Objectweb Fractal14 Archetypes under org.objectweb.fractal • Objectweb Petals15 Archetypes under org.objectweb.petals • ops4j Archetypes under org.ops4j • Parancoe16 under org.parancoe • slf4j Archetypes under org.slf4j • Springframework17 OSGI and Web Services Archetypes under org.springframework • Trails Framework18 Archetypes under org.trailsframework
19

And these were just the archetypes that were listed under the Nexus Indexer Catalog, if you switch Catalogs you'll see other archetypes. While your results may vary, the following additional archetypes were available in the Internal Catalog: • Atlassian Confluence20 Plugin Archetype under com.atlassian.maven.archetypes • Apache Struts21 Archetypes under org.apache.struts • Apache Shale Archetypes under org.apache.shale A catalog is simply a reference to a repository index. You can manage the set of catalogs that the m2eclipse plugin knows about by clicking on the Configure... button next to the catalog drop down. If you have your own archetypes to add to this list, you can click on Add Archetype.... Once you choose an archetype, Maven will retrieve the appropriate artifact from the Maven repository and create a new Eclipse project with the selected archetype.

3.1.3. Creating a Maven Module
m2eclipse provides the ability to create a Maven module. Creating a Maven module is almost identical to creating a Maven project as it also creates a new Maven project using a Maven archetype. However, a Maven module is a subproject of another Maven project typically known as a parent project.

19

Don't use the Groovy Maven Plugin in Codehaus' Mojo project. Jason Dillon has moved the Groovy Maven integration to the Groovy project in codehaus. For more information see http://groovy.codehaus.org/GMaven.

20

Figure 3.4. Creating a New Maven Module

When creating a new Maven module you must select a parent project that already exists inside of Eclipse. Clicking the browse button displays a list of projects that already exist as shown in Figure 3.5, “Selecting a Parent Project for a New Maven Module”:

Figure 3.5. Selecting a Parent Project for a New Maven Module

After selecting a parent project from the list, you are returned to the New Maven Module window and the Parent Project field is populated as shown in Figure 3.4, “Creating a New Maven Module”. Clicking Next will then display the standard list of archetypes

21

Version. Adding Dependencies to a New POM 22 . Click the Next button to start adding dependencies.2.6. Figure 3. Create a Maven POM File Another important feature m2eclipse offers is the ability to create a new Maven POM file. choosing the Packaging type. and providing a Name into the fields provided and m2eclipse. 3.from Section 3. entering the Group Id. m2eclipse provides a wizard to easily create a new POM file inside of a project that is already in Eclipse. “Creating a Maven Project from a Maven Archetype” so you can choose which one should be used to create the Maven module.6.2. Artifact Id.7. “Creating a New POM”: Figure 3. This POM creation wizard is shown in Figure 3.1. Creating a New POM Creating a new Maven POM is just a matter of selecting a project.

3.As you can see in Figure 3.com/books/nexus-book/reference/).commons with commons-vfs expanded to see which versions are available. m2eclipse is making use of the same Nexus repository index that is used in the Nexus Repository Manager. Figure 3. “Querying the Central Repository for Dependencies”: Figure 3.7. Highlighting the 1. “Importing a Maven Project” shows the wizard for importing projects with the options for Maven provided by m2eclipse: 23 . “Querying the Central Repository for Dependencies” shows a query for org. Now that the you’ve seen the m2eclipse features for creating a new project. Importing Maven Projects m2eclipse provides three options for importing a Maven project into Eclipse including: • Import an existing Maven project • Check out a Maven project from SCM • Materialize a Maven project Figure 3. “Adding Dependencies to a New POM” here are no dependencies in the POM yet.apache.1-SNAPSHOT version of commons-vfs and clicking OK takes you back to the dependency selection where you can either query for more artifacts or just click finish to create the POM. Querying the Central Repository for Dependencies Querying for dependencies is as easy as entering the groupId for the artifact you need.9. a repository manager introduced in "Repository Management with Nexus" (http://www. let’s look at a similar set of features for importing projects into Eclipse.sonatype.8. Just click the Add button to query the central Maven repository for dependencies as shown next in Figure 3. When you search for dependencies.8.8.3.

and Materialize Maven Projects. there are three options available for importing a Maven project into Eclipse including: Maven Projects.9. Import command in Eclipse and then filtering the options by entering the word maven in the filter field. Importing a Maven Project The dialog in Figure 3. Importing a Maven Project m2eclipse can import a Maven project with an existing pom.9. “Importing a Maven Project” is displayed by using the File. “Importing a Multi-module Maven Project”. 3. Importing a Maven project from Subversion is identical to the creation of a Maven project from Subversion as discussed in the previous section so discussion of it would be redundant.xml.3. 24 . Let’s move on now to review the other two options for importing a Maven project into Eclipse. As noted above.Figure 3. By pointing at the directory where a Maven project is located.1.10. m2eclipse detects all the Maven POMs in the project and provides a hierarchical list of them as shown in Figure 3. Check out Maven Project from Subversion.

and you need to get your hands on the source code. Instead of tracking down the project web site and figuring out how to check it out of Subversion. This comes in handy if your project depends on a third-party open source library. just use the m2eclipse project to magically "materialize" the Eclipse project. “Materializing a Maven Project” shows the wizard after choosing to materialize Maven projects: 25 . the Subversion URL is discovered from the project’s root POM file. Using this feature. m2eclipse will import and build the project(s) using Maven.2. You can use this feature to "materialize" projects from nothing more than a POM file if the POM file has the appropriate elements to specify the location of a source repository. “Importing a Multi-module Maven Project” displays the view of the project being imported. 3. Figure 3. Notice that all the POMs from the project are listed in a hierarchy.Figure 3.10.3. and materialize them into Eclipse projects. Importing a Multi-module Maven Project Figure 3. Once you select the project you would like to import.11. This allows you to easily select which POMs (and therefore which projects) that you want to be imported into Eclipse. Materializing a Maven Project m2eclipse also offers the ability to "materialize" a Maven project. you can browse the central Maven repository for projects. Materialization is similar to the process of checking out a Maven project from Subversion. but instead of manually entering the URL to the project’s Subversion repository.10.

Materializing a Maven Project Notice that the dialog box for Maven artifacts in Figure 3.12. 26 . “Materializing a Maven Project” is empty. “Selecting Artifact to Materialize” shows how to add a project: Figure 3. This is because no projects have been added yet.13.11. “Materializing Apache Camel”. you must click the Add button on the right side and select a dependency to add from the central Maven repository. Figure 3. In order to add a project. candidate dependencies will be located in the local Maven repository. Select the dependency to add and click OK so that they are added to the list as shown in Figure 3.Figure 3.11. the list of candidate dependencies appears.12. After a few seconds of indexing the local Maven repository. Selecting Artifact to Materialize Upon entering a query.

27 . Materializing Apache Camel Upon adding a dependency.Figure 3.13. you have the option of telling the m2eclipse plugin to check out all projects for the artifact.

.

. Figure 4. Show View.2. install.. Console... Running Maven Builds 4. or package.2.. You can also load up the Run configuration dialog window and configure a Maven build with parameters and more options.3.. and Debug As. Then click on the little arrow on the right-hand side of the Open Console icon and select Maven Console as shown below: Figure 4. Enabling the Maven Console in Eclipse Maven Console shows the Maven output that normally appears on the console when running Maven from the command line. Running Maven Builds m2eclipse modified the Run As. 4. you can choose Run Configurations. Figure 4. menus to allow you to run a Maven build within Eclipse...2. Enabling the Maven Console Before we begin to examine the features of m2eclipse. If you need to configure a Maven build with more options. “Running an Eclipse build with Run As. From this menu you can run one of the more common lifecycle phases like clean.” shows the Run As. Open the Console View by going to Window. menu for an m2eclipse project...1. and create a new Maven build.Chapter 4. Figure 4..1. It is useful to be able to see what Maven is doing and to work with Maven debug output to diagnose issues. let’s first enable the Maven console. Running an Eclipse build with Run As. “Configuring a Maven Build as a Run Configuration” shows the Run dialog for configuring a Maven build.

3. Configuring a Maven Build as a Run Configuration The Run configuration dialog allows you to specify multiple goals and profiles. and allows you to customize everything from the project to the JRE to the environment variable. 30 .Figure 4. it exposes options like "skip tests" and "update snapshots". You can use this dialog to support any custom Maven build that you wish to launch with m2eclipse.

Maven Preferences for Eclipse The check boxes in the top section provide the ability to: • Run Maven in Offline mode. “Maven Preferences for Eclipse” shows the Maven preferences page in Eclipse: Figure 5. If you need help selecting a goal.1.1..m2 directory and as command line options. disabling any downloads from remote repositories • Enable Debug output in the Maven Console • Download Source jars for artifacts from remote Maven repositories • Download JavaDoc jars for artifacts from remote Maven repositories • Download and Update local indexes for remote repositories on startup The next section offers a pop-up menu to select which goal you’d like to be executed when a project is imported and when the source folders for a given project are updated. “Maven Goal Dialogs” shows the Goals dialog with a list of all the phases in the default Maven lifecycle.2. click the Select. m2eclipse Preferences 5. Maven Preferences The ability to adjust the Maven preferences and some Maven options is an important aspect of developing with Maven and m2eclipse offers the ability to tweak these items via the Maven preferences page inside of Eclipse.. The dialog on the left-hand side ofFigure 5. button to see the "Goals" dialog.1. m2eclipse provides access to some of the most important preferences and options from the Eclipse IDE. such preferences and options are available from files in your ~/. Customizing this list of goals can come in handy if you need to run any custom goals which process resources or generate supporting configuration. The default goal is named process-resources which copies and process the resources for the project into the destination directory to make the project ready for packaging. Typically when using Maven on the command line. Figure 5.Chapter 5. .

There are over two hundred plugins with selectable goals in the Goals dialog.2. Maven Goal Dialogs When you see the Goals dialog for the first time. there's a chance you might be overwhelmed by the number of goals it lists.Figure 5. m2eclipse is going to narrow the list of available goals to goals which contain the text in the search field. Another Maven preference page is the Maven Installations configuration page shown in Figure 5.3.3. as you type in text. You can always narrow the list of goals shown in this dialog by typing in some text to the search dialog. to running integration tests. to performing static analysis. the dialog on the right-hand side ofFigure 5. “Maven Goal Dialogs” shows the "Goals" dialog with the Tomcat Maven plugin's goals highlighted. “Maven Installations Preference Page”: Figure 5. to generating web services with XFire.2. Maven Installations Preference Page 32 . There are literally hundreds of Maven plugins for everything from generating a database.

a project will only list it’s name and relative path in the Package Explorer as shown in Figure 5.xml of the selected Maven installation. and an installation of Maven 2. and you can customize the location of your local Maven repository from the default location of ~/. “Enabling the Maven Version Decorator”. Also available in the Eclipse preferences is the ability to enable a decorator named the Maven Version Decorator. Figure 5. Figure 5. If the Maven Version Decorator is not enabled.9. Maven 2. Maven will use the default global settings file found in conf/settings.m2/settings.0.4.3.4.5. “Enabling the Maven Version Decorator”. The Installations configuration page also allows you to specify the location of the global Maven settings file. If you want to use a different version of Maven with the m2eclipse plugin you can configure multiple installations of Maven from this configuration page.4. button. If you do not specify the location of this file on this configuration page. This preference provides a given project’s current version on the Eclipse Package Explorer and is shown in Figure 5. “Package Explorer without Maven Version Decorator”: 33 . this is very similar to the ability to add more than one Java Virtual Machine to be run inside of Eclipse.1-SNAPSHOT.xml.This page allows you to add other Maven installations to the Eclipse environment. “Maven Installations Preference Page” shows a configuration page that lists the Maven Embedder.m2/ repository.. Enabling the Maven Version Decorator To enable this preference. This is what is used to execute Maven inside of Eclipse. simply check the Maven Version Decorator option that is highlighted in Figure 5. If you have another installation of Maven which you would like to use instead of the Maven Embedder. you can add another Maven runtime by clicking on the Add. An embedded version of the Maven known as the Maven Embedder is already specified. You can also customize the location of your user settings file from the default location of ~/.

Figure 5. “Package Explorer with Maven Version Decorator Enabled”: Figure 5.6. the project name will include the current project version as shown in Figure 5.5. Package Explorer with Maven Version Decorator Enabled This is a helpful feature that provides the project version at a glance instead of being required to open the POM to locate the version element. Package Explorer without Maven Version Decorator Upon enabling the Maven Version Decorator. 34 .6.

Working with Maven Repositories m2eclipse also provides some tools to make working with Maven repositories a bit easier.Chapter 6. Each option is available by clicking on the Navigate menu as shown in Figure 6. Searching for Artifacts and Classes Notice the available options in Figure 6. The Open Maven POM option allows you to search the Maven repository for a given POM as shown in Figure 6.1. “Searching for Artifacts and Classes” under the Eclipse Navigate menu named Open Maven POM and Open Type from Maven.1.2.1. These tools provide functionality for: • Searching for Artifacts • Searching for Java classes • Indexing Maven repositories 6. Searching For Maven Artifacts and Java classes m2eclipse adds a couple of items to the Eclipse Navigation menu that make searching for Maven Artifacts and Java classes easy work. “Searching for Artifacts and Classes”: Figure 6. Working with Maven Repositories 6.1. “Searching for a POM”: .2.

Upon opening this dialog. This feature allows you to search for a Java class by name in a remote repository. simply type ‘factorybean’ and you’ll see many classes with the name FactoryBean in them as shown in Figure 6. “Searching the Repository for a Class”: 36 . This is handy when you need to take a quick look at the POM for a given artifact. the POM for that artifact is opened in Eclipse for browsing or editing.3. The second m2eclipse option in the Navigate menu is named Open Type from Maven. Searching for a POM Upon selecting an artifact and clicking OK.2.Figure 6.

“Show Maven Indexes View”: Figure 6.4. Indexing Maven Repositories The Maven Indexes View allows you to manually navigate to POMs in a remote repository and open them in Eclipse. 6. type the word "maven" into the search box and you should see a view named Maven Indexes as shown in Figure 6. m2eclipse will show you the list of artifacts in which it appears. go to the Navigate menu and search for the class. Other. Show Maven Indexes View 37 .3. If you need to use a specific class. Searching the Repository for a Class This is a big time saving feature because it means that manually searching through artifacts in a Maven repository for a particular class is a thing of the past.Figure 6. just fire up Eclipse. Show View.4. go to View.3. To see this View.

These features make working with remote repositories from inside of Eclipse so much easier and faster. Locating a POM from the Indexes View After finding the apache-camel artifact.visiting repositories through a web browser.5.6. Figure 6. 6.Select this View and click OK. Using the Maven Repository view in m2eclipse you can: • Browse your Local Maven repository • Browse global repositories such as the Central Maven repository • Browse a repository which captures artifacts generated by Maven projects in your Eclipse workspace • Rebuild a Nexus Index from scratch • Update a Nexus Index with incremental changes 38 . “Locating a POM from the Indexes View” shows the Maven Indexes View after manually navigating to locate a POM: Figure 6. double-clicking on it will open it up in Eclipse for browsing or editing. “Maven Indexes View”: Figure 6. Maven Indexes View Additionally.6.4.you'll find that m2eclipse is a welcome change for the better. After all the hours you may have spent doing these types of tasks by manually over the last few years . downloading artifacts and grepping through them for classes and POMs . Browsing and Manipulating Maven Repositories The m2eclipse plugin allows you to browse and manipulate repository indexes. This will show the Maven Indexes View as shown in Figure 6.5.

Figure 6. Opening a View in Eclipse Once you select Other. Select the Maven Repositories view under the Maven folder in the Show View dialog as shown in Figure 6.7. Eclipse will display a dialog containing all available views.8. Other.1. Opening the Maven Repository View To browse Maven repositories and to manipulate repository indexes open the Maven Repositories view by selecting Windows.8. “Opening a View in Eclipse”.. as shown in Figure 6. Figure 6..7..• Modify the scope of repository indexing with a "minimal" or "full" index • Disable Indexing for a repository • Materialize a Maven project from information stored in a POM 6. Selecting the Maven Repositories View in the Show View Dialog 39 .. Show View. “Selecting the Maven Repositories View in the Show View Dialog”.4.

you will be able to browse the contents of the repository and double click on specific artifacts.m2/settings.3. If the POM for a particular artifact contains valid SCM information. Figure 6.Once you have selected Maven Repositories and clicked on the OK button. 40 .xml). Browsing Your Workspace Repository m2eclipse maintains an index of artifacts generated by your Eclipse workspace. Browsing a Global Repository In addition to loading an artifact's POM in the Form-based POM Editor.9. you are familiar with the Central Maven repository. It also contains a repository that represents the Maven projects contained in your Eclipse workspace.xml file or in an active Maven Profile.4. If you expand the central repository. This view contains three folders: Local Repositories This folder contains your local Maven repository which is stored in ~/.m2/repository by default. This "workspace" repository is shown in Figure 6. Double-clicking on one of the artifacts shown in Figure 6. Global Repositories This folder contains any global Maven repositories that are referenced by all Maven projects. you will see artifacts that correspond to your workspace project as shown in Figure 6. Project Repositories This folder contains repositories which are defined by your projects. If you expand this folder. These repositories are present either in your project's pom. 6. Browsing Global Repositories If you have been using Maven. “Browsing the m2eclipse Workspace Repository” under the Local Repository folder.4. This folder contains the Central Maven repository under the repository identifier of "central".2. 6. Eclipse will then load the Maven Repositories view.9. It will also contain mirrors that have been configured in your Maven Settings (~/. you can also right click on a artifact and choose Materialize Project. “Browsing the m2eclipse Workspace Repository”. m2eclipse can "materialize" the project from source control into your workspace.10.10. This is default repository from which Maven will retrieve dependencies and other artifacts needed during a build. “Browsing a Global Repository” will load that artifact's POM in the Form-based POM Editor.

Browsing a Project Repository The Maven Repositories view is also intelligent enough to keep track of any repositories that have been added to your project via your Maven Settings. an active Maven Profile. Click on the "Create.11. Maven. add a repository element to a pom. To demonstrate this feature..4. 41 .4." button and add a new repository with the following values as shown in Figure 6.sonatype... or that have been added directly to a project's POM.Figure 6.. “Adding a Repository to a Project's POM”. by loading the Form-based POM Editor and clicking on the Repositories tab. • Repository Identifier: flexmojos • Repository Name: Flexmojos Repository • URL: http://repository.org/content/groups/flexgroup/ Note You will only see the Repositories tab in your Form-based POM Editor. POM Editor. Browsing the m2eclipse Workspace Repository 6..xml. if you have set your Maven preferences to "Show advanced tabs in the POM Editor" under Eclipse.10. Preferences.

Project POM with a Custom Repository Now that the pom.13.xml contains a custom repository.12.12. Figure 6. Adding a Repository to a Project's POM Save the POM and open the pom. The refresh icon looks like two opposing yellow arrows. The project's pom. “Browsing a Project Repository”. 42 . “Project POM with a Custom Repository”.11.xml should contain the repositories element shown in Figure 6.Figure 6. click on the refresh icon shown in the upper right-hand of Figure 6. and clicking this icon will cause the Maven Repositories view to refresh the list of repositories from the selected project and your configured Maven settings.xml tab in the POM Editor.

14. it will download a Nexus index from the remote repository. version. This can be a useful tool if there is another process outside of Eclipse that is going to be modifying a local Maven repository.6. This index is what allows you to quickly search for and locate dependencies by artifactId. Rebiuld Index This will rebuild an index for a local repository by iterating through the contents of a repository and recreating a Nexus index from scratch. Browsing Your Local Repository The Maven Repostitories view allows you to browse and manipulate your local Maven repository index. If m2eclipse is managing a local repository (local or workspace) it will use the open source Nexus indexer to create and maintain a local index. Browsing Your Local Maven Repository 6.Figure 6.4. Manipulating a Repository Index Every repository that m2eclipse uses is indexed by the Nexus Indexer. Browsing a Project Repository Once you have added a project repository and clicked on the refresh icon in the Maven Respositories view.4. Figure 6. you will be able to view the project-specific repository and manipulate the repository index for this project-specific repository. 43 .14.13. 6.5. you can use this interface to browse artifacts that have been loaded into your local repository as shown in Figure 6. If m2eclipse is using a remote repository. “Browsing Your Local Maven Repository”. m2eclipse maintains an index for the contents of your local repository. groupId. or classname. You can manipulate the index that is associated with a Maven repository by right-clicking on a repository in the Maven Repositories view and selecting one of the following actions: Update Index This will update the index by running an incremental update or by downloading and index from a remote repository.

This can come in handy if you have a series of repositories which you do not want to include in artifact searches. If your organization maintains a number of specialized. “Updating a Repository Index” shows two indexing options that control the scope of a particular Nexus index: Enable Min Index Configures the Nexus Indexer to maintain a minimal index that doesn't contain information about class names. segregated repositories that hold snapshots. 44 .Disable Index Choosing this option causes m2eclipse to skip index generation for a repository. Updating a Repository Index Figure 6.15. Figure 6. Enable Full Index Configures the Nexus Indexer to maintain a full Index that includes the class names contained within each artifact. you may not want to include these artifacts in simple searches for artifacts that contain a particular identifier or class.15.

or use the features discussed in the next section to manually locate the artifact information in the repository indexes.2. the Eclipse progress in the lower right-hand corner of the Eclipse workbench reflects the action as shown in Figure 7. we're going to add commons-lang as a dependency. Figure 7.1. “Updating Maven Dependencies”: Figure 7. the project’s Maven Dependencies container will be automatically updated to include the new dependency. Figure 7. “Searching for a Dependency” shows this functionality: . Using m2eclipse 7. Adding and Updating Dependencies and Plugins Let’s say we’d like to add a dependency or a plugin to the camel-core POM. Manually Adding a Dependency to the Project's POM Manually adding a dependency works well but requires more work than the second approach. The first option is by manually editing the POM file to type in the XML to add the dependency. “Manually Adding a Dependency to the Project's POM” shows how I added a dependency for commons-lang to the camel-console POM and the Maven Dependencies container was automatically updated to included it: Figure 7. Updating Maven Dependencies The second option for adding a dependency is much easier because you don’t have to know any information about the artifact other than its groupId.) m2eclipse offers two options for adding dependencies to a project. Upon manually adding the dependency element to the POM. For the sake of demonstration. (Please note that the functionality for adding a dependency or a plugin is exactly the same so we’ll demonstrate it by adding a dependency.1. The upside is that after manually adding the dependency and saving the POM.1.1.2. The downside to manually editing the POM file to add a dependency is that you must already know the information about the artifact.Chapter 7.3.

1. If workspace resolution is disabled. nothing can be easier than being able to right click on a third-party dependency and drill into the code in the Eclipse debugger. when workspace resolution is enabled. and a URL for an issue tracker. 7. These are the project's web page.1. and it will remove the Maven Dependencies classpath container from your project. This option is preferred because it is such a tremendous time saver.1. This has the effect of telling m2eclipse to stop trying to manage your project's classpath. and that project-a depends on project-b.3. and m2eclipse will attempt to download the source artifact from the Maven repository. Searching for a Dependency By simply entering a groupId into the query field. If you do this. a URL for a continuous integration system like Hudson. the m2eclipse Maven build for project-a will only succeed if project-b's artifact is present in the local repository. If these URLs are present in a project's POM. you can download the source from the repository and expose it to the Eclipse environment. 46 . the URL for the source code repository. In other words. Assume that project-a and project-b are both in the same Eclipse workspace. Opening Project Pages A Maven POM contains some valuable URLs which a developer may need to consult. you should ask the maintainers of the project in question to upload the appropriate Maven source bundle to the central Maven repository.4. This has the effect of altering the way that Maven locates dependency artifacts. With m2eclipse. Select this option. project's don't have to be installed in the local repository to relate to one another. you are essentially on your own when it comes to managing your project's classpath. If it is unable to retrieve this source artifact.2.Figure 7. m2eclipse will open these project pages in a browser. m2eclipse queries the repository indexes and even shows a version of the artifact that is currently in my local Maven repository. Resolving Dependencies You can configure a project to resolve dependencies from a workspace. When you are trying to debug a complex issue in Eclipse. 7.3. you no longer need to hunt through the central Maven repository for an artifact version. these artifacts do not need to be present in your local repository. Downloading Source If the central Maven repository contains a source artifact for a particular project. 7. If a project is configured to resolve dependencies from the workspace. m2eclipse will resolve the dependency via the Eclipse workspace. If workspace resolution is enabled. You can also disable dependency management.

Figure 7. “Locating Dependencies in the Dependency Tree” shows what happens when you click on commons-logging in the "Resolved Dependencies" list.4. Analyzing Project Dependencies in m2eclipse The latest release of m2eclipse contains a POM editor which provides some dependency analysis tools.4. and packaging. it can often become confusing with a project starts to depend on tens of dependencies. If you open a project with many dependencies. and it is the effective list of dependencies that your project will use for compilation. While this is a great feature that attracts people to using Maven in the first place. each with tens of transitive dependencies.2. If one of your requirements is to exclude a dependency like commons-logging or the servlet-api. If you are writing an application which depends on the Spring Framework's Hibernate3 integration. testing.7. all you need to do is depend on the spring-hibernate3 artifact from the Central Maven Repository. Searching and filtering functionality available in the editor makes it really easy to search and browse trough the project dependencies. or when you start encountering conflicts between transitive dependencies. The right-hand side of this panel displays the resolved dependencies. Figure 7. The left-side of the panel displays a tree of dependencies. The first level of the tree consists of direct dependencies from your project. you can use this tool to find out what dependencies (and what transitive dependencies) 47 . If you are trying to get rid of a resolved dependency. The left-hand side is a great way to figure out how a specific dependency made its way into your project's resolved dependencies. These tools promise to change the way people maintain and monitor a project's transitive dependencies. You can use “Search” entry field from the editor tool-bar and “Sort” and “Filter” actions from “Dependency Hierarchy” and “Resolved Dependencies” sections to navigate trough dependencies. This is the list of effective dependencies after all conflicts and scopes have been applied. you can open the Dependency Tree tab and see a two-column display of dependencies as shown in Figure 7. or if you need to find out why a certain dependency is showing up under a specific scope you will frequently need to invoke the dependency:tree and dependency:resolve goals from the command-line to track down the offending transitive dependencies. and each subsequent level lists the dependencies of each dependency. Maven then reads this artifact's POM and adds all of the necessary transitive dependencies. clicking on a resolved dependency filters the hierarchy on the left-hand side of the panel to show all of the node which contributed to the resolved dependency. Problems start to happen when you depend on a project with a poorly crafted POM which fails to flag dependencies as optional.5. Dependency Tree Tab of the POM Editor The feature which makes the Dependency Tree tab so valuable is that it can be used as an investigative tool to figure out how a specific dependency made it into the list of resolved dependencies. “Dependency Tree Tab of the POM Editor”. One of the main attractions to Maven is the fact that it manages a project's dependencies. This is where the POM editor in m2eclipse comes in handy. When filtering is enabled in “Dependencies Hierarchy” section.

Viewing the Dependencies of a Project as a Graph The graph presentation can be changed by right clicking in the editor. In other words. Direct dependencies are linked from the top box and the transitive dependencies are linked from those. Locating Dependencies in the Dependency Tree m2eclipse also provides you with the ability to view your project's dependencies as a graph. Figure 7. Note that “open folder” icon on each graph node indicates that the corresponding artifact is present in the Eclipse workspace and “jar” icon indicates that the node's artifact is referenced from the Maven repository.are contributing the artifact to your resolved dependencies. The top-most box is the idiom-core project and the other dependencies are shown below it. versions.5. Figure 7. Figure 7.6. You can choose to show artifact ids. “Viewing the Dependencies of a Project as a Graph” shows the dependencies of idiom-core. “Radial Layout of Dependency Graph” shows the same graph from Figure 7. or you can use the Search field at the top of the page to find matching nodes. Figure 7. “Viewing the Dependencies of a Project as a Graph” with a radial layout. if you are trying to get rid of something like commonslogging from your dependency set. You can select a specific node in the graph to highlight the linked dependencies. 48 . or if you want to wrap node text or show icons.7.6. the Dependency Tree tab is the tool you will likely want to use. group ids. scopes.6.

Radial Layout of Dependency Graph 49 .7.Figure 7.

.

“Available Maven Features” the available Maven features for the camel-core project. By right-clicking on the camel-core project. We’ll use that project to demonstrate these features.1. Issue Tracker. snapshots and source folders • Creating a Maven module • Downloading the source • Opening Project URLs such as the Project Web Page. Working with Maven Projects The m2eclipse plugin also provides a set of features for working with Maven projects once they are inside of Eclipse. and Continuous Integration tool. and selecting the Maven menu item. Available Maven Features Notice in Figure 8. you can see the available Maven features. In the previous section. Source Control. There are many features that ease the ability to use Maven in Eclipse so let’s dive right into them.1. “Available Maven Features” shows a screenshot of this: Figure 8.1.1. including: • Adding dependencies and plugins • Updating dependencies.Chapter 8. Figure 8. I materialized a Maven project and selected a subproject from the Apache Camel project named camel-core. nested Maven modules and dependency management These features are also big time savers so let’s review them briefly. Using m2eclipse 8. • Enabling/Disabling workspace resolution. .

and that project-a depends on project-b. When you are trying to debug a complex issue in Eclipse. when workspace resolution is enabled.2.3.xml with an easy-to-use GUI interface. If these URLs are present in a project's POM. / Maven POM Editor".8.. you are essentially on your own when it comes to managing your project's classpath. click on a project's pom. Assume that project-a and project-b are both in the same Eclipse workspace. 8. To open the POM Editor. If you do this. These are the project's web page. Note The Form-based POM Editor is only available if you selected the POM Editor component when you installed the m2eclipse Eclipse plugin. If workspace resolution is enabled. The POM Editor will then display the Overview tab as shown in Figure 8. the m2eclipse Maven build for project-a will only succeed if project-b's artifact is present in the local repository. 8. Using the Form-based POM Editor The latest release of the m2eclipse plugin has a form-based POM editor which allows you to edit every part of a project's pom.1.1. m2eclipse will open these project pages in a browser. Downloading Source If the central Maven repository contains a source artifact for a particular project. project's don't have to be installed in the local repository to relate to one another. This has the effect of altering the way that Maven locates dependency artifacts. the URL for the source code repository. One common complaint about Maven is that it forces a developer to confront large and often overwhelming XML documents in a highly complex multi-module project build. Select this option..xml file.3. nothing can be easier than being able to right click on a third-party dependency and drill into the code in the Eclipse debugger. In other words. and the POM Editor is not the default editor.xml file. If workspace resolution is disabled. While the authors of this book believe this is a small price to pay for the flexibility of a tool like Maven. If you've customized the editors for a pom. a URL for a continuous integration system like Hudson.1.1.2. these artifacts do not need to be present in your local repository. If it is unable to retrieve this source artifact.1. and a URL for an issue tracker. you should ask the maintainers of the project in question to upload the appropriate Maven source bundle to the central Maven repository. m2eclipse will resolve the dependency via the Eclipse workspace. and m2eclipse will attempt to download the source artifact from the Maven repository. see Section 2. 8. 52 . Resolving Dependencies You can configure a project to resolve dependencies from a workspace. “Overview Tab of POM Editor for idiom-core”. you can download the source from the repository and expose it to the Eclipse environment. “Installing m2eclipse Core Components”. you may need to right-click on the file and choose "Open With. For more information about installing the m2eclipse plugin. This has the effect of telling m2eclipse to stop trying to manage your project's classpath. Opening Project Pages A Maven POM contains some valuable URLs which a developer may need to consult. You can also disable dependency management. the graphical POM editor is a tool that makes it possible for people to use Maven without ever having to know about the XML structure behind a Maven POM. If a project is configured to resolve dependencies from the workspace. and it will remove the Maven Dependencies classpath container from your project.2.

You can double-click on those entries in order to open its POM in the POM editor.2. plugins and other elements that have corresponding Maven artifacts. 53 . Overview Tab of POM Editor for idiom-core The project shown in Figure 8.2. This is due to the fact that idiom-core inherits most of this information from a parent project named idiom. If we open the pom.Figure 8. That “open folder” icon on the various list entries throughout the POM editor indicate that the corresponding entry is present in the Eclipse workspace and “jar” icon indicates artifacts which are referenced from the Maven repository. You'll notice that most of the fields in this idiom-core project are blank.3. There is no groupId or version and there is no SCM information supplied in the POM editor. Underlined labels in several POM editor sections represent hyperlinks which can be used to open the POM editor for corresponding Maven artifact.xml for the parent project in the POM Editor we would see the Overview tab shown in Figure 8. dependencies. “Overview Tab of POM Editor for idiom Parent Project”. This works for modules. “Overview Tab of POM Editor for idiom-core” is a project with an artifactId of of idiomcore.

“Effective POM for idiom-core”. similarly to “mvn help:effective-pom” command and displays the POM editor with the effective values. It will load the effective POM for idiom-code in the POM Editor as shown in Figure 8.3. this effective POM Editor is read-only. etc. If you wanted to look at the idiom-core project's effective POM in the POM editor. The POM editor is going to show you the contents of the POM that you are editing. the grandparent.Figure 8.). which shows a left bracket and an equals sign on a page with a blue M. Overview Tab of POM Editor for idiom Parent Project In this parent POM.4. Effective POM for idiom-core This effective view of the POM merges the idiom-core POM with the ancestor POMs (the parent. we see that the groupId and version are defined and that the parent POM supplies much of the information which was missing in the idiom-core project. Figure 8.4. 54 . Because the POM editor is display a composite view of many different merged POMs. you can use “Show Effective POM” action from the tool-bar in the upper right-hand corner of the POM editor. and it will not show you any of the inherited values. and you will not be able to update any of the fields in this effective POM view.

5. as well as editing the dependencyManagement section of the POM. “Dependencies Tab of the POM Editor” which exposes an easy-to-use interface for adding and editing dependencies to your project. There is a dependencies tab shown in Figure 8. Figure 8. The final tab exposes the pom. Dependencies Tab of the POM Editor The build tab shown in Figure 8. “Overview Tab of POM Editor for idiomcore”. 55 . you can use “Open Web Page” action from “Dependency Details” section toolbar to check the project web page. add extensions. “Build Tab of the POM Editor” provides access to the contents of the build element. If you need to know more about one of the artifacts. This dependency management screen is also integrated with the artifact searching facilities in the m2eclipse plugin.xml as an XML document. and add resources directories. The POM editor shows a number of showing various information from the POM.2. as well as Ctrl-Space typing assistance for the fields in “Dependency Details” section.5. you can also navigate to the parent POM using. You can use actions from the editor sections. change the default goal name.If you were looking at the POM editor for the idiom-core project as shown in Figure 8. ”Open Parent POM” action from the POM editor tool-bar in the upper righthand of the POM editor.6. From this tab you can customize source directories.

If you are interested in seeing the rest of the tabs.Figure 8. 56 . m2eclipse is the first step toward an IDE that is aware of the rich semantic treasure that is the central Maven repository. If you've tried to use Eclipse and Maven together without a tool that can comprehend the hierarchical project relationships that are central to any multi-module Maven project. more projects are going to be releasing Maven Archetypes.6. Build Tab of the POM Editor We only showed a small subset of the POM editor. and more projects are going to see value in publishing source artifacts to the Maven repository. you will know that the ability to work with nested projects is essential to smooth integration between the Eclipse IDE and Maven. 8. As more people come to use m2eclipse. please download and install the m2eclipse plugin. Summary m2eclipse is more than just a simple plugin which adds Maven support to Eclipse.3. it is a comprehensive integration that will make everything from creating new projects to locating third-party dependencies orders of magnitude easier.

.Part II. Maven Studio for Eclipse The second portion of this book deals with Maven Studio for Eclipse.

.

Example: a senior developer who has been on the team for years might still use Eclipse 3. This process usually encompasses setting up the tools used during development . or CVS) • Integrated Development Environments (Eclipse IDE) • Automated Testing Tools (Selenium) • Application Servers / Containers (Websphere. Perl) • General Utilities (cygwin. a feature fully introduced and defined in Section 9. SQL Server) • Scripting Languages (Ruby.1. Python. other utilities) The best-case scenario is an organization which maintains a detailed list of software components required in a development environment.1.1. New programmers will often notice a slight variation in the versions of components used by other programmers in the same group.1. The Cost of New Developer Onboarding On average. This section describes some of the challenges involved in Developer Onboarding. while newer developers might just download the latest version of Eclipse 3. 9. install baseline requirements such as a Java Development Kit and other languages or fundamental frameworks. MySQL. this often includes components like: • Source Control tools (Subversion.com . it typically takes a new developer five days before they can start contributing to a project. “A Representative 5-Day.5.4. compilers. and deploy code.2. Introduction Maven Studio for Eclipse currently provides Developer Onboarding. and other tools used to design. Tomcat) • Build Tools (Maven. emacs. During this 5-day period. Ant) • Databases (Oracle. 1 mailto:info@sonatype. Git. a developer will complete the tasks described below and illustrated in Figure 9. 9. Jetty.2.an Integrated Development Environments.Chapter 9. and provides some context for the Developer Onboarding feature now available in Maven Studio for Eclipse. Most new developers spend at least half a day familiarizing themselves with the installation and configuration process for new development infrastructure. “Developer Onboarding”. write. debug.2. In most organizations this information isn't firmly fixed in time as different developers set up environments as they are introduced to a project.com1. Day 2 Downloading Components Download all of the components required for a development environment. Clearcase. Manual Onboarding”: Day 1 Workstation Setup Setup a workstation. test. Developer Onboarding Developer Onboarding can be defined as the process of bringing a developer "onboard" a particular development project. For more information about Maven Studio for Eclipse. Introduction to Maven Studio for Eclipse 9. please contact info@sonatype. Day 2 Self-directed Learning Developers not directly familiar with tools like Maven will need to learn how to install and configure these tools.

Manual Onboarding 60 . a developer will usually require the assistance of other members of the development team. Who is responsible for various components. Day 5 Configuring Development Environment Once a developer can build the code. how is the source checked out of source control. the next step is to configure a local development environment. More dicussions with members of the same group about source code are usually accompanied by an overview of the various source control systems and structure of the various groups. Subversion) Ad-hoc Training Day 4 Checking Out Source Code Learning Build System / Customizing Settings Day 5 Configuring Development Environment Integrating 3rd Party Projects Productive Figure 9. Most organizations require some level of customization for a build to work properly. this may involve setting up a local instance of a database and populating that database with test data. If the organization has already standardized on a tool like Apache Maven." Day 4 Source Code It is just at Day 4 that a developer starts to think about accessing source code. a local testing database must be configured. Day 4 Build System Once the code is properly checked out and imported into your IDE. there is usually some work involved in figuring out how the build works and how it should be configured properly. a developer will need to build an entire system. and how often is it updated. this could be as simple as typing in "mvn clean install" at the command prompt. Day 3 Ad-hoc Training After setting up and environment. Eclipse must be installed and configured. Day 1 Introduction HR Tour Technical Overview Team Meeting Workstation Setup Day 2 Downloading Components Self-directed Learning Day 3 Installing Software (Eclipse. Day 5 Integrating 3rd Party Projects If an enterprise application depends on 3rd-party open source projects. Ad-hoc training sessions will involve other developers communicating standards and software: "Have you used JUnit before? This is how we run a unit test. If a developer is working on an enterprise application. Checking out source code is as much about learning about the organizational structure of a code base as it is about learning how that code maps to project groups.Day 3 Installing Software Once all of the required software has been downloaded. Whether this means that a developer needs to fully understand a custom Ant build or just find out how to configure Maven settings to connect to a Nexus repository. A Representative 5-Day. the IDE settings must be customized to account for specific standards used by the organization. it must be installed and configured. a developer will often checkout relevant source code from open source projects and configure them alongside the development environment for internal code.1.

In today's software development environment. a component called the MSE Installer downloads an XML descriptor which captures all of the configuration parameters for a completely customized build environment. As most developers only configure a workstation once or twice a year. “A Representative 5-Day. This process is not unlike process most Java developer used to use to obtain dependencies for a Java project. When you know it will only take a few minutes to install a development environment. tours. Developers don't realize exactly how much time is wasted on workstation setup until they've wasted an entire day downloading and installing the various software components involved in an environment. a build engineer can capture all of the components required for a development environment in an MSE Codebase. Maven Studio for Eclipse makes your organization more agile. When it only takes a new developer a few minutes to get his or her workstation setup. Maven Studio for Eclipse takes one of the central ideas of Maven. you won't have to build in a week of downtime into your schedule for new developers. a developer needs to not only configure an IDE. If your project needs the help. They change the dynamics of the group and make it possible to focus more on your application's code and less on the tools required to build it. Manual Onboarding” condensed into a single day.2. configure the system to interact with source control. you can hire a new developer to make focused changes without having to sacrifice five days of time to inefficient manual setup. and configure a build. and Maven and just start to code. When a developer materializes an MSE Codebase.3. 61 . Onboarding with Maven Studio for Eclipse: Productive on Day One With Maven Studio for Eclipse. they can take more time in the first days to learn about projects and architecture.1. Increased efficiencies do more than save time and resources. the true complexity is always somewhat surprising. more efficient. Day 1 Introduction HR Tour Technical Overview Team Meeting MSE Onboarding Productive Figure 9. a developer simply clicks on a link to materialize an MSE Codebase. This new ability to get prouctive quickly also changes the way in which developers are added to a project. Gone are the days when a developer could simply install Java. This MSE Codebase is then published to Nexus Team edition and is downloaded by a developer in a process called "Materialization". capture your development environment in a descriptive codebase.2.2. but instead of relegating a developer to a week of manual installation and configuration tasks. she needs to connect that IDE to a collection of infrastructure resources like JIRA and Confluence. An MSE Codebase can be materialized in a few minutes. “Minimizing Onboarding Time with Maven Studio for Eclipse” shows the process from Figure 9. and meetings. a new developer can be productive on Day One.2. and it applies this concept to your development environment. participating in development discussions and decisions instead of disappearing into a cave to install software.9. Use Maven Studio. and install any number of supporting components. the idea that you can describe your project and let Maven take care of downloading components from a central repository. a software developer had to manually download and configure a set of libraries. and let Maven Studio for Eclipse take care of the details. these tools have also increased the cognitive burden on software developers. and connect an increasing number of components. a set of dependencies. Figure 9. checkout all required source code. As open source software tools and components have created a wealth of choices. 9. They can start to engage a group socially. and once this process is done.2. Managing Developer Workspace Complexity Developers spend most of their time connecting components within a development environment to one another. Instead of asking your developers to download. Eclipse. Minimizing Onboarding Time with Maven Studio for Eclipse The ramifications of this easy setup process are more than just time saved and efficiencies gained. configure. A developer's first day on the job is still characterized by introductions. Before the arrival of Maven.

or "disposable" development environments consider the ongoing invest of time and effort to keep a development environment up to date.3. or "disposable" development environments. the amount of investment necessary to update and maintain your development environment. The cost to change your developer's environments is small enough that you can start making changes without having to worry about the logistics of such a change. 62 . high-investment development environments.3. To illustrate the benefits of low-risk.= + Maven Studio Figure 9. "disposable" development environments. and low-risk. you start to decrease the amount of time. Once you've created a system that allows you to redeploy a new development environment over hundreds of workstations in a few hours. Consolidating Complexity into Eclipse IDE 9. Managing Change in Development Environments When you use Maven Studio for Eclipse Developer Onboarding. and you standard your entire development team's environment on managed Eclipse codebases. The follow two examples illustrate the differences between using high-risk. you've implemented low-risk.

This is commonly accepted practice." 63 . the same testing infrastructure. and a common approach to tools. tested. I'd rather wait until we've completed this cycle to implement this change. We have to wait for people to have enough time available to follow our instructions. technical managers are going to be very careful about introducing any change into the environment in the middle of an active product development cycle. It doesn't seem worth it given the risk that our timelines will be affected. This two weeks is not the time it takes for any one developer to implement a change. and then migrate individual developer workstations over to a new development environment." Manager: "How long is it going to take to test and deploy this fix to 100 developers?" Build Engineer: "One week of testing and about a week to deploy the changes to every team." Manager: "If it isn't critical. and while developers and project managers are working on architecture issues and other plans. retrain themselves on the latest versions of build systems and IDEs. and source control. train developers. Getting a new laptop after two years of working can often introduce as much downtime in project schedules as hiring a new employee. and it makes sense to introduce risky changes at the beginning of a product lifecycle when there is enough time to mitigate any unexpected problems that might be introduced by such a change. 9. This two week period is the time it takes for build engineers to introduce the change. The product development lifecycle in this particular organization is twelve months. or source control locations needs to be refactored or split. there is a build engineer or an architect who is tasked with documenting a standard set of tools and procedures for development. Disadvantages of a High-Risk Development Environment Assume that it takes about two weeks to deliver change to the development environment. Figure 9. maybe the organization also uses this time period of refresh engineer's laptops. A new Eclipse-based plugin needs to be configured.3. high-risk strategy for testing and deploying changes to development infrastructure: Build Engineer: "They just released a new version of Maven to address some of the issues we are having with the Surefire plugin.4. Let's also assume that the entire team uses the same development environment. In this scenario. This team of 20 developers is split up into 4 teams of five engineers. This tools selection and standardization process usually takes two weeks to complete. managers are not likely to approve any changes.1. or if a new version of Maven is made available that enables greater flexibility. The point here is that technology management understands that there is some downtime at the start of a project to allow the senior technical talent to introduce newer approaches technologies into the mix. and each developer also has the potential to install different versions on a workstation. very often when a new development stack is introduced. developers manually build workstations from a set of instructions. The Common Scenario: Upgrading Development Infrastructure Consider a average sized workgroup of 20 developers and 5 project managers. While we are not dealing with new employees. fictional dialog captures the reality of a development group with a manual. and delivered to every developer workstations. developers and managers need to recalibrate knowledge of tools. At the start of a project development cycle. If a new version of Eclipse is introduced which improves performance. “High-risk Development Environments Discourage Change within Constrained Development Cycles” illustrates the endresult of having such a high-risk approach to development environments. Questions like: What version of Eclipse are we standardizing on? What is the structure of our source code repository? What tools do we need to standardize on for testing? All of these questions are answered at the beginning of the project.9. senior developers from each team usually meet to decide upon changes to the development tool stack.2. and each team works with a project manager to set direction and track progress. releases. From initial product design to testing to implementation and lastly final delivery takes. on average about twelve months start to finish.3. Because the process of deploying change to a development environment take two weeks to fully implement. The following. The two week period is the length of time it takes for most developers to convert and for every developer to work out any issues which may arise during an environment upgrade.

High-risk Development Environments Discourage Change within Constrained Development Cycles If you work in one of these environments you'll recognize this situation. If the department needs to upgrade from Eclipse 3. and project managers can no longer object to a simple.Start Development Cycle (12 months) High-risk Changes to Dev Environment (2 weeks) Figure 9. “Low-risk Development Environments Enable Greater Flexibility within Constrained Development Cycles” illustrates the new dynamic introduced by low-risk changes to development environment. this change can be executed in a matter of hours. Most importantly.3.0 or upgrade to a newer version of the m2eclipse plugin.1 to Eclipse 3. Developers are also risk averse because every time the build engineers come up with a new idea they lose a substantial amount of time following a loosely documented. it alters the dynamic between the build engineer and the project planners. If the build engineer proposes a change to the development environment which involves an upgrade to Eclipse or Maven. developers can rull back to a previous version of the published Codebase and continue developing. the build engineer is often identified as the enemy of project stability and the team resists changes to the development environment.5. Advantages of a Low-risk Development Environment When an organization has standardized on low-risk.6. Figure 9. In this scenario.5. every engineer in the group can materialize the same development environment. developers can rollback.3. ad-hoc process for running manual updates. the build engineer can make the case that this change is low-risk. repeatable process with a guaranteed fallback plan. if the newly published MSE Codebase has a problem or an issue. A build engineer can test a change to a development environment. publish a codebase to Nexus Team Edition and then send an email to hundreds of developers instructing them to materialize the latest codebase. disposable development environments using Maven Studio for Eclipse. 64 . If the proposed change introduces errors. 9. Managers are understandably risk-averse because they know that there is no automatic method for deploying changes to development environments. With Maven Studio for Eclipse.4. it doesn't take two weeks to convince your developers to upgrade to a new development environment. it takes little or no time to redeploy changes across all developer workstations. This ability to quickly deploy a development environment doesn't just save time. It can be implemented in a single day and deployed in minutes to every developer. In minutes.

4. You can use this mechanism as an opportunity to make sure that developers working on a particular system are following the right feeds. In reality. If a new version of Eclipse or a critical tool from a vendor is updated. you gain the ability to make sure that developers are paying attention to the right pieces of information. this is not immediately obvious. distribute. developers working on open source are communicating to large groups of volunteers over public channels such as Twitter and GitHub. If you don't spend your time programming. If your development group involves open source. and everyone will have a standard environment immediately. and using other means of communication. In this industry. you can upgrade your development infrastructure whenever you need to. Think of feed support in the MSE product like having a project specific feedreader that you can configure. having heated debates on mailing lists. 65 . test it. For people not directly involved in a development effort. “Low-risk Development Environments Enable Greater Flexibility within Constrained Development Cycles” shows a 12-month product development lifecycle with a series of low-risk changes to the development environment. Instead of waiting to schedule high-risk project downtime for infrastructure changes. cryptic Subversion commit messages. Consolidating Project Feeds Developing good software is a very social activity. Maven Studio for Eclipse enables much greater flexibility within constrained development cycles because it makes development environment "disposable". you will be able to quickly test and deploy this fix across your department wthout having to make the case to management to set aside time for the upgrade. Low-risk Development Environments Enable Greater Flexibility within Constrained Development Cycles Figure 9. Maven Studio for Eclipse provides a mechanism for aggregating feeds for a Source Tree.Start Development Cycle (12 months) Low-risk Changes to Dev Environment (1 day) Figure 9. publish. With Maven Studio for Eclipse. You don't have to invest everyone's time in the installation and upgrade of development infrastructure. and update. do in once. Development doesn't have to come to a complete halt when it only takes a few minutes to materialize a codebase.5. good developers are constantly interacting on IRC.5. you might just think developers are doing nothing more than staring at Eclipse twelve hours a day and communicating with each other using terse. 9. using Issue Trackers such as JIRA. information is of primary importance and making sure that your developers are keeping up to date on the ever increasing number of technologies they need to know is important.

66 . Aggregating a Single Project's Feeds 9. While this strategy of constantly flooding each developer with activity emails accomplishes the job. proprietary codebases for cloud computing while making massive. it also ignores the fact that every piece of development infrastructure provides support for common feed standards such as RSS and Atom. Nexus Professional has a smaller team of programmers who are all directly employed by Sonatype. and dscussing strategy using services like Twitter. this aggregated feed is something a developer has to fetch himself. vibrant development community that includes many developers not directly employed by Sonatype.4. and another source tree pointing to a public. monitoring production systems using Nagios. When a new piece of development infrastructure such as JIRA or Subversion is added to a project. Maven Studio for Eclipse integrates with these feed standards and it gives build engineers a standard mechanism to make sure that every developer is paying attention to the same set of valuable feeds.. Companies large and small are starting to build systems to expose an open source core or API to the public which relates to a commercial product or commercial extension. you may configure an MSE Codebase with two source trees. and tell your developers to materialize the latest version of a codebase. In minutes. “Aggregating a Single Project's Feeds” illustrates how Maven Studio for Eclipse Source Trees can be used to aggregate this information into a simple project activity feed presented in the Eclipse IDE. private source code repository. SVN: Commit 423242 by jvanzyl: Updated the storage implementation to account for NoSQL Source Control (Subversion) Production Monitoring (Nagios) MSE Codebase Source Tree Social Media (Twitter) Wiki (Confluence) Nagios: Warning on app01: Disk utilization currently at 97%. 400 out of 400 tests passes.. collaborating on documentation using Atlassian's Confluence wiki. changing source code stored in Subversion.6. Usually this means that every bit of development infrastructure involved in the development effort is configured to push automated emails to developer. publish it to Nexus Team Edition. Address problem immediately. tracking builds using Hudson. . Companies like Google develop large. or a new tool like Sonar which generates a useful RSS feed. If you've installed a new source control system. continued contributions to the open source projects it depends on.2. Figure 9. Complex Scenarios: Mixed Open/Commercial Development A increasingly common scenario in enteprise development is the hybrid open source/commercial development effort. just update the codebase. In these scenarios. a developer has to figure out how to integrate any available activity streams into his personal feed reader.9.1. Another common scenario is a company which develops a complex enterprise system which relies heavily on customized open source components. one proprietary source tree pointing to your own. Figure 9. Sonatype's Nexus repository manager is just such a project. you can make sure that everyone is paying attention to the same activity stream within Eclipse. Without Maven Studio for Eclipse. Nexus Open Source has a large. all of these channels create a constant stream of events and which help developers track activity.4. Simple Scenario: Aggregating a Project's Feeds If your team is tracking project progress using Atlassian's JIRA issue tracker. Continuous Integration (Hudson) Issue Tracker (JIRA) Project Activity Twitter: @Brian_Fox: The new production build is now available from Central Staging Hudson Build #423 Success: Triggered by SVN Commit 423242. open-source repository.6.

SVN: Commit 423242 by jvanzyl: Updated the storage implementation to account for NoSQL Source Control (Subversion) Open Source Source Tree Production Monitoring (Nagios) Social Media (Twitter) Wiki (Confluence) Nagios: Warning on app01: Disk utilization currently at 97%. open-source projects that the system depends on and they can keep track of internal activity. Continuous Integration (Hudson) Issue Tracker (JIRA) Source Control (Subversion) Commercial Source Tree Production Monitoring (Nagios) Nagios: Warning on app01: Disk utilization currently at 97%. Address problem immediately.. open/commercial development effort. Figure 9. and you can configure the Commercial source tree to track private activity logs from internal issue trackers and source code control systems.. 400 out of 400 tests passes. Twitter: @SonatypeNexus: RSO is running Nexus Team Edition. Continuous Integration (Hudson) Issue Tracker (JIRA) Project Activity Twitter: @Brian_Fox: The new production build is now available from Central Staging Hudson Build #423 Success: Triggered by SVN Commit 423242. Increased coverage. public mailling lists.In the scenario of a mixed. Twitter: @SonatypeNexus: RSO is running Nexus Team Edition. twitter accounts of the main contributors. Address problem immediately.ly/arznMT Social Media (Twitter) Wiki (Confluence) . See announcement: http://bit. you can configure the Open Source source tree to track public components: public issue trackers.ly/arznMT SVN: Commit 233 by juven: Fixed bugs reported by Windows 64-bit users. See announcement: http://bit.7. They can keep up with the critical. Aggregating Multiple Project's Feeds 67 . Developers will then see a unified view of project activity.

.

Chapter 10. Maven Studio for Eclipse Quickstart
10.1. Introduction
Maven Studio for Eclipse (MSE) gives you the ability to capture common configuration and projects for your developers with the Developer Onboarding feature. Using the Developer Onboarding feature, you can very quickly configure and deliver a common configuration across your entire enterprise. Newly hired developers or developers just starting on a new project usually take days to setup and configure all of the moving parts that go into an efficient development environment. With Developer Onboarding, a build engineer can capture all of the requirements in an MSE Codebase and publish this Lineup to a simple, single-click solution which will download, install, and configure an Eclipse IDE with all of the components necessary to be productive in minutes.

10.1.1. What is a Codebase?
A Codebase describes an entire development environment including both the configuration of Eclipse and the projects that are to be checked out from source control. The Codebase contains two parts: A Lineup and one or more Source Trees as shown in Figure 10.1, “Maven Studio for Eclipse Codebase Contents”.

MSE Codebase
Eclipse Preferences

Codebase Description/Icon

Source Tree
SCM Information

(one or more)

Project Information Source Roots

MSE Lineup
Eclipse Distribution Eclipse Plugins/ Components

Figure 10.1. Maven Studio for Eclipse Codebase Contents

10.1.2. What is a Lineup?
A Lineup describes an Eclipse environment: the version of Eclipse installed, the versions of individual components of the Eclipse framework, and an inventory of all option or 3rd party plugins installed in a given environment. When you use MSE to simplify your environment, you publish a Lineup to Nexus Team Edition.

10.1.3. What is a Source Tree?
A Codebase includes one or more Source Trees. A Source Tree is a location in a Source Control Management system like Git or Subversion. For example, if your lineup needs to checkout projects from two internal corporate Subversion servers, your Lineup would include two Source Trees pointing to two Subversion locations. A Source Tree can contain one or more Roots.

10.1.4. What is a Source Tree Root?
A Root is a location within a SCM repository which is imported into an Eclipse installation as a Maven project. If a Source Tree does not define a list of Roots, it has an implicit root of “/”, this is the directory in which Maven Studio for Eclipse will look for a Maven POM to import. If you want to control the directories from which a project will be imported from a Source Tree, you would define one or more Source Tree Roots. For example, if you configured a Source Tree to point to the Subversion URL http://yourserver.com/svn/trunk, and you configured a Root at project-a/ and a Root at project-b/, MSE will checkout the source from these two directories and import these directories as Maven projects. Every defined Root must contain a Maven pom.xml file for a successful import.

10.1.5. Use Case for a Build Engineer
A Build Engineer uses Maven Studio for Eclipse to create a Codebase and publish this Codebase to a repository on Nexus Team Edition. Once this Codebase has been published, the Build Engineer can then send a an e-mail to team members directing them to a one-click installation.

Maven Studio for Eclipse

Nexus Team
MSE Codebase P2 Proxy

Figure 10.2. Maven Studio for Eclipse Interacting with Nexus Team Edition

10.2. Getting Started with Maven Studio for Eclipse
In this quickstart guide, you will: 1. Configure Nexus Team Server 2. Materialize the Sample Demo Maven Lineup 3. Create a Custom MSE Codebase 4. Configure a Custom MSE Lineup 5. Configure an MSE Source Tree 6. Publish an MSE Codebase to Nexus Team Server 7. Materialize a Custom MSE Codebase

70

10.2.1. Nexus Team Edition Prerequisites
Before starting the installation, make sure that you have satisfied the following preconditions for the server running Nexus Team Edition: • Nexus Team Edition must be installed on a server that does not have Nexus Open Source or Nexus Professional installed on it. • You are running a Java 6 Java Development Kit downloaded from Oracle on the server that will run Nexus Team Edition. • You will need administrative privileges on the server running Nexus Team Edition.

10.2.2. Workstation Prerequisites
Before starting the installation, make sure that you have satisfied the following preconditions for the workstations which will be running Maven Studio for Eclipse and materializing Eclipse installations from Nexus Team Edition: • You have installed a Java Development Kit version 1.6.0_18 or higher from Oracle. Maven Studio for Eclipse requires a JDK version of 1.6.0_18. • If you are installing Maven Studio for Eclipse into an existing Eclipse installation, you must remove any previously installed version of the m2eclipse plugin.

10.3. Installing Nexus Team Edition
The first step for setting up your environment for Maven Studio for Eclipse is to install Nexus Team Edition.

10.3.1. Download Nexus Team Edition
If you are reading this quickstart guide, you should have received an e-mail from Sonatype containing instructions for downloading Nexus Team Edition. Download the nexus-team-webapp-1.6.1.1-bundle.tar.gz or nexus-webapp-1.6.1.1-bundle.zip archive to the server which is going to host Nexus.

10.3.2. Unpack Nexus Team Edition
After downloading the Nexus Team Edition archive, unpack the archive: • On a Linux machine, you might install Nexus Team Edition in /usr/local/nexus-team-1.6.1.1 or /opt/nexus-team-1.6.1.1. • On a Windows machine, you might choose to install Nexus Team Edition in c:\Program Files\Nexus Team.

10.3.3. Start Nexus Team Edition
To start Nexus Team Edition locate the appropriate platform directory under ${NEXUS_HOME}/bin/jsw • On Windows, run nexus.bat to start Nexus. • On OSX or Linux, run nexus start to start Nexus, and nexus stop to stop Nexus.

Note
On Windows, you may be prompted to allow the service to modify the Windows Firewall.

10.3.4. Login as a Nexus Administrator
Go to http://localhost:8081/nexus, and login with the default administrator credentials: Username: admin, Password: admin123

71

Configure Proxy Settings If your Nexus Server needs to use an HTTP Proxy. you must configure a few Nexus Server settings which will affect the publishing of P2 Lineups.. Figure 10. Opening the Server Configuration Panel 10. Opening the Server Configuration Panel 10. 10.4. 10.3.4. open up the Server configuration panel by selecting Administration # Server from the Nexus menu. Figure 10..4.6.4.5. Figure 10.Figure 10. button.4. Select Proxy Repository. Go to Views/Repositories -> Repositories. Login to Nexus Team Edition 10. Later on in this guide. you will be creating a custom Lineup which includes the Eclipse Checkstyle plugin. Configure Nexus Team Server Once you have installed the Nexus Team Edition. add a new P2 Proxy Repository for the Eclipse Checkstyle (eclipse-cs) plugin. Add a New P2 Proxy Repository Next.1. Adding a New P2 Proxy Repository 72 . Open the Nexus Server Configuration Panel To configure your Nexus Server.3.4. you must configure the proxy settings in the Nexus Server configuration.4. and click on the Add.2. Save the Nexus Server Configuration Click on Server Configuration panel’s Save button to save your Nexus server configuration.

Configure the New Proxy Repository Once you’ve created the New Proxy repository.8. Run the Publish Lineups Scheduled Task in Nexus Team Server After configuring your Nexus Team server. press the Refresh button to refresh the status of the running job. Configuring New Proxy Repository for Checkstyle Plugin 10. While the job is running. the status will change to SUBMITTED as shown in the following figure. click on Administration # Scheduled Tasks in the Nexus Menu. Running the P2 Lineup Publishing Task While the job is running. Execute a Scheduled Task for P2 Lineups To execute a scheduled task.5.5.5.4. you must create a Scheduled Task to Publish a P2 Repository Lineup. and select Run.7.2. This job will run for approximately 1-3 minutes. Verify P2 Lineups are Published After running the job. the Status is RUNNING. 10. 73 .1. Figure 10. Locate the “Publish P2 Lineup” Job in the list of configured tasks. configure the following parameters for the new repository: Figure 10. 10.10.9.5. click on the Refresh button in the Scheduled Tasks panel as shown in the following figure. Opening the Scheduled Tasks Configuration Panel Click Yes in the confirmation dialog to execute the Scheduled Task. Once the Job is completed. Right-click on this task. Figure 10.

Select Sonatype MSE Repository In the list of Nexus Managed Repositories.4.jnlp file and choose Download. Select Nexus Managed Repositories The MSE Codebase Repository is a Nexus Managed Repository. go to the Browse Storage tab and navigate to the org/sonatype/mse/codebases/ demo-maven/0.Figure 10.0. 10.1. In this quickstart guide. Viewing Nexus Managed Repositories 10.1 folder. Selecting the Onboarding Repositories 10.11. you are ready to materialize one of the demo workspaces. Verify the Completion of the P2 Lineup Publishing Task 10. Once this workspace is materialized. Right-click on the mse-codebase. This repository contains the sample Apache Maven lineup. Once the Repositories panel is open. select the MSE Codebase Repository.6.3. Click on the MSE Installer for the Maven Lineup Maven Studio for Eclipse ships with a demonstration project: the Apache Maven project.2.6. you are going to materialize the sample Maven workspace.6. you can then use Maven Studio for Eclipse to create your own custom P2 lineups. select Nexus Managed Repositories from the repository type drop down. 10.10. The first thing you will want to do is materialize one of these lineups to get a fully functioning installation of Maven Studio for Eclipse. you should see a list of all of the User Managed Repositories.12.6. Figure 10. Figure 10.6. click on Views/Repositories -> Repositories. Once you select the Onboarding Project Repository. To view all Nexus Managed Repositories. 74 . Open the Repositories Panel To open the Repositories Panel. Materialize a Sample Workspace Once you’ve configured Nexus Team server and published the demo P2 lineups.

jnlp file. Downloading the Demo Maven Installer 10. you will be asked to verify that the MSE Installer is trusted. Figure 10. Figure 10. the M2E installer will validate that is can connect to the source code repository and Nexus. Java Web Start will download. Supply Server and Source Control Credentials You will then be asked to supply credentials for any source code repository or server involved in the installation process. and start the MSE Installer. Running the MSE Installer 10.6.13. Check the Anonymous access checkbox to the right of the Username field and click on the Next button.15. If this is the first time you are running the MSE Installer. Run the MSE Installer When you download the mse-codebase. Click Next on the following dialog: 75 .6. verify.5. Supply Subversion and Source Control Credentials Once you click next.14.Figure 10.6.

Once the Eclipse workspace has been materialized. give the tool a few minutes to update indexes and to checkout project source code from source control. Once this process is finished. the MSE installer will ask you to supply two directories: The Installation Directory. where the MSE Installer installs Eclipse. 76 . and the Workspace Location.6. Successful Validation of MSE Installer Requirements 10. Supplying Installation Directories for MSE Installer 10.17. Verify Completed Eclipse Installation Clicking on Finish will start the process of installing the Eclipse IDE with all of the plugins specified in the MSE Lineup.6.Figure 10. You can Supply custom directories or accept the default values supplied by the MSE installer. you can start to work with the projects it checked out. Note Windows may prompt you to authorize the Eclipse IDE the first time it has been launched. Specify Installation Directories Next.8. Once the installation is completed.16.7. You may see a firewall dialog asking for permission to execute Eclipse. you should see an Eclipse IDE installation. You should approve this request. where MSE Installer puts projects and code. Figure 10. Once the Eclipse IDE is visible. you should see a list of projects in the Apache Maven project.

19. Maven Projects Displayed in Eclipse 10.Figure 10. 77 .6. click OK. Configure Password Recovery On some platforms. Figure 10. Once you’ve typed in these questions and answer. Click Yes in the Secure Storage dialog. Eclipse will then prompt you to set up the Master Password and Password Recovery options in Eclipse. Creating a Master Password for Eclipse Password Recovery In the Password Recovery dialog type in two questions that will allow you to recover the master password for this Eclipse workspace.9.18.

you’ve already used that capability to materialize the demonstration instance of Maven Studio for Eclipse which contains the Maven project. If you’ve followed the instructions in this document.1. 10.. in Eclipse as shown in the figure below.7. Next. Figure 10..Figure 10.20. Create a New MSE Lineup Project To create a new MSE Lineup.7. you are going to use the custom lineup capabilities of Maven Studio for Eclipse to define a custom lineup which will checkout source code from a Subversion repository. click on File -> New --> Other. Creating a New Lineup Project (Select New -> Other) 78 .21. Creating a New MSE Lineup Maven Studio for Eclipse gives you the tools you need to define a custom Eclipse installation which can be materialized with a simple click of a button. Configuring Password Recovery 10.

10. The Group ID groups projects together and is often unique to an organization or a project. select New P2 Lineup from the Maven Studio for Eclipse folder in the wizard selection dialog. The Artifact ID is a unique identifier for a project (or in this case a Lineup). Figure 10. and Version. 79 . Supply Lineup Coordinates and Nexus Credentials Note Every artifact in Nexus has a coordinate which consists of a Group ID. Enter your administrative credentials for Eclipse in this dialog and supply Lineup Coordinates for your MSE Lineup.7.2.3. Change the Group Id to “com. Figure 10. Click on Next. Select the New P2 Lineup Wizard Next.22.7. Configure Nexus and Lineup Coordinates Clicking Next will display a dialog that contains the Nexus Server URL. Creating a New Lineup Project (Select New P2 Lineup Wizard) 10. and the Lineup Coordinates.sample” or choose a group identifier that makes sense for your organization. the Nexus credentials used to connect to Nexus. Artifact ID.23.

10. Select Runtime Platform and Memory Select the platforms that are appropriate for your platform. These two components are required for all Maven Studio for Eclipse installations.0. Specify the heap size for your Eclipse installation in megabytes.5. Maven Studio for Eclipse will use the current Eclipse installation as a template for your new P2 Lineup. The default components are Maven Studio Materialization Support and Sonatype Studio Base IDE Lineup. Note that the version number for Maven Studio Materialization Support is 0. this list should contain Eclipse plugins. Select Runtime Platform and Memory Note If you select “Load Installable Units from Current Eclipse Installation”. Figure 10. and check the “Load Installable Units from Current Eclipse Installation” checkbox.7.0” version number tells Eclipse to install the latest version currently available.7. If you selected “Load Installable Units from Current Eclipse Installation” in the previous step.0.0. This interface is where you configure the contents of the P2 Lineup. components. Configuring Contents of a P2 Lineup The first list of “Installable Units” are the plugins and components that are installed in your Eclipse installation. 80 . This special “0. Figure 10. You can configure which Eclipse components and plugins are installed in a materialized Eclipse installation.24. and update sites configured in your current Eclipse installation.25.4.10. Configure the Contents of the Lineup The next step in the P2 Lineup wizard is the Lineup Editor.

sf. Adding the Checkstyle Installable Unit to the Lineup Editor 10.6.. Add the Checkstyle Plugin Installable Unit After adding the repository. Figure 10..26.10. Adding the Checkstyle Repository to the Lineup Editor Name the new repository “Eclipse-Checkstyle Integration” and use a Location of: http://eclipse-cs. button in the Lineup Editor.. click on OK.7. Then in the Lineup Editor add a new Installable Unit by clicking on Add. Verifying the Lineup Summary 81 .7.net/update” into the Work with: field.7. click on the Next button.7.27. Figure 10. Figure 10.8. When you click on Next. Maven Studio for Eclipse will verify that it has access to the appropriate proxy repositories on Nexus Team server.28. Enter “http://eclipse-cs.. Add a New Repository Click on the Add. press Enter. and then select the most recent version of the Checkstyle plugin. Verify the P2 Lineup Once you have added the Checkstyle repository and the Checkstyle plugin as an installable unit.sf. next to the list of Installable Units.net/update/ 10.

Once Maven Studio for Eclipse materializes an Eclipse installation it will also checkout Maven projects from source control. you should see the Codebase Overview in your Eclipse environment. you would be configuring your Codebase to pull projects from your own source control system. instead of configuring your Codebase to pull projects from an Open Source project. In this section.8. you will see the following form. Viewing Your New Codebase in the Eclipse IDE 10. you are going to configure your newly created Codebase to checkout source code from an open source Subversion repository. Maximize the Codebase Overview by clicking on the maximize button as shown below. Maximize the Codebase Overview If you just completed the previous section and defined a P2 Lineup. If the baseline Codebase Overview is not already loaded. 82 .30.29. Figure 10. In a corporate environment.xml in the misc folder under the baselineup project in your Eclipse workspace. click on mse-codebase.8. When you configure a P2 Lineup. Configuring a New Codebase Once you’ve created and configured your P2 Lineup. 10. Maximizing the Codebase Overview Once you have maximized the Codebase Overview.Clicking Finish will create the P2 Lineup in your workspace under the Artifact ID of your new lineup. you will need to configure a Source Tree for your Codebase. you are telling Maven Studio for Eclipse what Eclipse components and plugins to install when it materializes an Eclipse installation from your Nexus Team server.1. Figure 10.

Then click on OK..4. Creating a New Source Tree Click on Create.8.org/repos/asf/commons/proper/lang/trunk 83 . 10.2. 10.8. Roots in the Source Tree. Create a New Source Tree A Source Tree is a collection of projects checked out from source control.Figure 10. the SCM location..31. and information about the project.32.apache. Configure the New Source Tree Once you create a new Source Tree. Configure the SCM Location Click on the drop down next to SCM Location and select “svn” as the Source Control protocol. the Codebase Overview will switch to a form that allows you to configure a new Source Tree. This dialog will show information about the source tree. under Source Trees and name your new Source Tree “Apache Commons”. Then type the following URL into the SVN location: http://svn. Codebase Overview 10.8. Figure 10.3.

Publish Your Codebase to Nexus In the upper right-hand corner of the P2 Lineup Overview form you should see a Publish button next to a server icon.1.9. open the P2 Lineup overview.33.9. Add a Feed URL Click on Create.Figure 10.8.5. under Feeds and add in the following URL for this mailing list feed: http://mail-archive. If it isn’t already open.org/mod_mbox/ commons-user/?format=atom Click on OK. 10. Publish Button on Codebase Overview 84 . Maven Studio for Eclipse will then attempt to access the source code repository to validate that you have access to this URL.apache. Configuring the Commons Feed URL 10. click on mse-codebase..xml under the baseline project in your Eclipse workspace. you can publish this Lineup to your Nexus Team server.35. 10.. Figure 10. Figure 10.34. Publishing a Codebase Once your P2 Lineup has been configured with a Source Tree. Configuring the Commons Source Tree Click on Validate Access.

To do this follow the same steps you used to materialize the demonstation Maven lineup which shipped with Maven Studio for Eclipse. and Maven Studio for Eclipse will publish the Codebase to your Nexus Team Server.10. 10. 10.jnlp file and select Download. Select the MSE Codebase Repository and navigate to the com/mycompany/baselineup/1.36. Published Codebase Descriptor After the Codebase has been published you can close Eclipse. and a Nexus password. Figure 10. Supply Nexus Team URL and Credentials Clicking the Publish button will display the Publish Codebase Descriptor dialog. a Nexus username.10. select the Views/Repositories -> Repository panel. Right-click on the mse-codebase.9. 85 . In this dialog you will supply the Base URL of your Nexus Team server. 10.1.2. Publish Codebase Descriptor 10.Clicking on this Publish button will tell Maven Studio for Eclipse to publish the newly configured P2 Lineup to your Nexus Team server.0 folder. Eclipse will ask you if you want to Save your current changes.9. Figure 10.37. Materializing a Codebase Once you have configured your Custom Codebase and published it to your Nexus Team Server you can test your new P2 Lineup by materializing it to your workstation. Download the Codebase Installer In Nexus Team server.3. Publish the Codebase Click OK. Click Yes. If your Codebase has unsaved changed. and then view the Nexus Managed Repositories.

Supply Nexus Credentials The MSE Installer will ask you for your Nexus credentials during the installation process. Figure 10.10.3. You should deselect the Anonymous access checkbox and supply your Nexus credentials. Figure 10. Supply Apache Subversion Credentials Since the Codebase created and published in the previous section contains a Source Tree that points to the Apache Subversion server.39.Figure 10.40. Supply Subversion Credentials to MSE Installer 10.10. Select Published Codebase Descriptor 10. use the default credentials admin/ admin123. Supply Nexus Credentials to MSE Installer 86 . you should leave Anonymous access checked and click on the Next button to continue.38.2. If you have not configured a new Nexus user.

4. A Materialized. Figure 10. You can use this same functionality to create custom. Use Your Materialized Eclipse Installation Once the materialization process is completed.41. Configure Materialization Directories Nexus supplies the directories for the materialization. Checkstyle View from Materialized Workspae 87 . If you want to override the default directories.42. Figure 10.10.10. Choosing Installation Directories in the MSE Installer 10.10.43. you will have a customized installation of Eclipse complete with the EclipseCheckstyle plugin and the source code for Apache Commons Lang. Eclipse Workspace Figure 10. specify an installation directory for the Eclipse installation and a workspace for your projects and workspace-specific configuration. Custom.5. one-click solutions for developer on-boarding.

org1.11. The connection to a Subversion server could be reset by either the server or the client. Troubleshooting Codebase Materialization This section attempts to summarize some of the problems that can occur during Nexus Team Edition installation and Codebase materialization. 10.44.org 88 .1. “Subversion Connect Reset During Materialization”. 1 mailto:book@sonatype. If the problem continues to happen even after a retry. restart the materialization process. Figure 10. and the most likely scenario is that there was some brief downtime on the server-side.11. Subversion Connect Reset During Materialization After the MSE Installer starts a newly installed Eclipse instance. Checking out a large project from a public Subversion server can involve a single. Although these servers are some of the most reliable and widely used source control systems you will find. If you encounter any problems or difficulties running through this quickstart chapter.44. you might experience problems during materialization if your connection is reset. If you see the error dialog shown in Figure 10. it will attempt to checkout source code from the source trees configured in the codebase. longlived connection to a remote server. Running the materialization again should be enough to fix this problem.10. Reset Subversion Connection The demonstration codebase contains source trees which depend upon public Subversion servers hosted by the Apache Software Foundation. please contact Sonatype at book@sonatype. you might want to investigate any process or system that mght be running locally to monitor and secure a network. Make sure that there are no security systems terminating the connection to the remote Subversion server on your end of the connection.

2. To create a new P2 Lineup in Eclipse. Creating a MSE Codebase There are two ways to create an MSE Codebase: Create a new P2 Lineup You can create a new P2 Lineup which captures an Eclipse configuration including all components and plugins installed in Eclipse. The following sections outline the details of both of these approaches. 11. you are configuring the Eclipse installation which will be associated with an MSE Codebase. This will display the wizard selection dialog.2. “Initial Screen of Lineup Wizard: Lineup Setup” captures lineup coordinates and information about the target Nexus Team Edition server. Creating a New P2 Lineup When you create a new P2 Lineup. Managing MSE Codebases and P2 Lineups 11. Figure 11.1. Artifact Id. and Version. you can create a new MSE Codebase. 11. This newly created MSE Codebase will have an empty P2 Lineup URL which will need to be populated using a URL of a previously published P2 Lineup.1. This includes the versions of all components and plugins which will be installed by the MSE Installer. Using the Developer Onboarding feature. Introduction Maven Studio for Eclipse (MSE) gives you the ability to capture common configuration and projects for your developers with the Developer Onboarding feature. “Selecting the New P2 Lineup Wizard”.. . Maven Studio for Eclipse will create a new Codebase and associate it with your new P2 Lineup. A P2 Lineup is published to Nexus and stored with a set of lineup coordinates: Group Id. go to File -> New and select Other. Your configuration will be validated against a Nexus Team Edition server to ensure that users will have access to P2 Proxy repositories for all the components required by your P2 Lineup. Create a new MSE Codebase Alternatively. Selecting the New P2 Lineup Wizard The initial screen of the new P2 Lineup Wizard shown in Figure 11.Chapter 11. After creating and publishing a new P2 Lineup.2. These coordinates uniquely identify a published P2 Lineup.1. you can very quickly configure and deliver a common configuration across your entire enterprise.1. and select New P2 Lineup as shown in Figure 11. Expand the Maven Studio for Eclipse folder..

For example. The verion number 0. This repository corresponds to the Eclipse Checkstyle Plugin-in feature listed under Installable Units.2. The Repositories section of the Lineup Edition contains all of the repositories required for a successful MSE Codebase materialization. “Editing a New P2 Lineup”. The Manage Nexus repositories link below the Repositories section will load the repositories list in Nexus Team Edition. The Lineup Editor displays two sections: Installable Units and Repositories.3.0 tells Eclipse to use the latest available version. the Repositories section contains an extra repository http://eclipse-cs. Initial Screen of Lineup Wizard: Lineup Setup Clicking Next loads the Lineup Editor shown in Figure 11. in Figure 11.net/update.3. There are two components which will always be a part of every MSE Codebase: Maven Studio Materialization Support This component contains the framework which supports MSE Codebase materialization. click on this Manage Nexus Repositories button and create any appropriate repositories in your Nexus Team Edition installation.0. If you need to add additional P2 Proxy repositories to support custom lineups. The Validate button in the Lineup Editor causes Maven Studio to connect to Nexus Team Edition and verify that all repositories and installable units are available. “Editing a New P2 Lineup”. Sonatype Studio Base IDE Lineup This component combines the basic features of Sonatype Studio including support for Subversion. and support for the Sonatype m2eclipse component. you will also need to add a new P2 Proxy repository to Nexus Team Edition. You can add new repositories to this list to support the installation of addition installable units.Figure 11. The Installable Units section configures the plugins and components which are going to be installed as a part of the MSE Codebase materialization. 90 . Git. If you have added a new repository to the Lineup Editor.sf.

“Add a Repository to a P2 Lineup”. “Editing a New P2 Lineup”. you need to make sure that Nexus Team Edition has a matching P2 Proxy repository. This will display the Add Repository dialog shown in Figure 11. Add an Installable Unit to a P2 Lineup To add a repository to a P2 Lineup.3. “Editing a New P2 Lineup”. 91 .. then select the appropriate Installable Units in this dialog.3.. Figure 11. “Add an Installable Unit to a P2 Lineup”. When you add a repository to a P2 Lineup..Figure 11.. next to the list of repositories shown in Figure 11. will load the Add Installable Unit dialog shown in Figure 11. or paste a new Update Site URL into the Work with dropdown field. click on Add.. click on Add.5. Editing a New P2 Lineup To a new an installable unit to a P2 Lineup. Clicking on Add.3. Select an existing repository.4.4. Clicking on OK will then return you to the P2 Lineup Editor with the Installation Units select added to the list of Installable Units configured for your new P2 Lineup. next to the list of Installable Units in the Lineup Editor shown in Figure 11..

8. “Summary of New P2 Lineup Identifiers”. and you want to create a new MSE Codebase. “Editing a New P2 Lineup” click Next.Figure 11.2. Selecting the New Codebase Project Wizard 11. selecting Other.7..2. Figure 11.6. MSE Source Trees. you will see the Codebase Overview shown in Figure 11.7. “Codebase Overview”.5. Once a Codebase has been properly 92 . Configuring a MSE Codebase Once you create a codebase. Expand the Maven Studio for Eclipse folder and then select New Codebase Project as shown in Figure 11..3. Figure 11. Summary of New P2 Lineup Identifiers 11. The MSE Codebase settings. Clicking Finish will cause Sonatype Studio to publish the new P2 Lineup to Nexus Team Edition and open a new MSE Codebase Overview form with the P2 Lineup field populated with the results of this wizard. Creating a New MSE Codebase If you already have a P2 Lineup configured. resources.. You can create a new MSE Codebase directly by going to File -> New.6. Add a Repository to a P2 Lineup Once you are finished configuring you new P2 Lineup in the Lineup Editor shown in Figure 11. and security are all configured from this interface. “Selecting the New Codebase Project Wizard”. You will then see the New MSE Codebase Descriptor dialog shown in Figure 11.3.

configuration. Codebase Overview At the bottom of the Codebase Editor. The Codebase editor contains the following sections: Codebase Information This section contains identifiers. it stores credentials in Security Realms. 93 . a name. This section is described in more detail in . “Managing Codebase Source Trees”. “Managing Codebase Source Trees”. source control. and a logo for the MSE Codebase. “Setting Codebase Prerequisites”.4.6. URLs.7. This section is described in more detail in Section 11. The P2 Lineup Location points to a file hosted by Nexus Team Edition which describes the configuration of Eclipse. “Managing Codebase Resource Locations”. This list of realms will be used to populate realm dropdownds throughout the Codebase and Source Tree editors. Figure 11.8. “Configuring Codebase Information”. Locations Locations holds URLs and resources which are associated with an MSE Codebase. This section is described in more detail in Section 11. Prerequisites This section contains configuration values which affect the operation of Eclipse. you will see a series of tabs for each of the configured MSE Source Trees. the codebase is saved as an XML file and then published to Nexus Team edition.configured. This section is described in more detail in Section 11. A source tree is a location in a source control server like Git or Subversion and it corresponds to a project or set of projects in an Eclipse environment. This section is described in more detail in Section 11.5. Source Trees An MSE Codebase contains one or more Source Trees. a description. or P2 Lineups. The process for creating and managing source trees is described in more detail in Section 11. Realms When the MSE Installer connects to remote resources to download settings.7. Source trees are locations in a source control system which correspond to one of more projects in an Eclipse workspace. and the Maven Settings and Eclipse Preferences associate configuration data with an MSE Codebase.

organization or project-specific identifier which generally matches the reversed.maven. a name.apache.<Minor Version>.xml This is the MSE Codebase descriptor. “Configuring Codebase Information” contains identifiers. Codebase Project Files 11.jar If you have configured the MSE Codebase editor to generate. Name This field stores a descriptive name for a codebase. and a major revision would have a version of "2. Figure 11. Although this icon is not currently displayed by Nexus Team Edition or the MSE Installer.<Point Release>".Once a Codebase has been configured and saved. and associate Eclipse preferences with an MSE Codebase.0.png This is the 48x48 icon which is used to represent this MSE Codebase in an MSE Catalog. Examples: The first version of the "ecommerce" codebase may have a version number "1. publish. Artifact Id The Codebase project identifier. Homepage This field contains a URL to the homepage associated with a codebase. a description. and an application icon for the Codebase. Maven Studio for Eclipse will have a project in the Project Explorer named after the Artifact ID of your Codebase which contains up to three files: mse-codebase. Image Every codebase can be associated with a 48x48 icon. This section contains the following fields: Group Id The group Id is an arbitrary. this JAR file will contain an export of the selected Eclipse preferences.10. Examples: com.". perioddelimited domain name of an organization plus any additional project identifiers.google. mse-codebase-preferences.0".0. it is the XML file which is published to Nexus Team Edition. and which is used to configured the Java WebStart JNLP application which is used to start the MSE Installer. com. A small update to this codebase would have the version number "1. Description This field contains a short.0.9. paragraph-long description of a codebase. URLs.1. mse-codebase-icon. org. Documentation This field contains a URL to a documentation page to be associated with a Codebase.nexus. Version A version adheres to the following format: "<Major Version>. This can be a page specific to the project or workgroup which is using this Codebase. 94 . Examples: developers working in the Ecommerce group would materialize a Codebase with an artifactId of "ecommerce".0".4.sonatype. Configuring Codebase Information The Codebase Information section shown in Figure 11. this icon will be visible in the upcoming Maven Studio for Eclipse Catalog feature. This artifact id is used to identify a codebase as an Eclipse project.

the P2 Lineup wizard finished and then immediately loaded a new MSE Codebase with this field pre-populated.html http://www.5.sonatype. your URL will resemble the following URL: http://localhost:8081/nexus/service/local/templates/settings/default/content Eclipse Preferences An MSE Codebase can distribute a set of common Eclipse preferences to cature common configuration settings that cover code standards. Maven Settings This field contains a URL for your Maven Settings. the Locations section shown in Figure 11. read "Managing Maven Settings"1 chapter in Repository Management with Nexus2. Configuring Codebase Information 11. Nexus Professional provides support for managing user-specific Maven Settings. The resources are: Security Realm The MSE Installer will use a single security realm to access all of the resources listed in the Location section.com/books/nexus-book/reference/security. and m2eclipse configuration. If you are using the default Maven Settings location in Nexus. If you created a new MSE Codebase using the New MSE Codebase wizard. P2 Lineup Location If you created your MSE Codebase using the New P2 Lineup wizard.11.10. Aspect-oriented programming settings. Figure 11. Configuring Codebase Resources 1 2 http://www.sonatype.Figure 11. the MSE Installer was designed with the expectation that all external configuration resources would be downloaded from the same Nexus server. this field will be empty and you will need to supply a URL from Nexus Team edition.html 95 .com/books/nexus-book/reference/security.11. To learn more about using Nexus Professional to manage and distribute Maven Settings. “Configuring Codebase Resources” tracks important configuration resources which can be associated with a Codebase. Although there are no restrictions for the URLs used in this section. Managing Codebase Resource Locations In the MSE Codebase editor.

To publish Eclipse preferences from the current Eclipse installation. If you have configured Maven Settings in Nexus.2.example. Open the Eclipse Preferences dialog shown in Figure 11. If you codebase is configured to download Maven Settings from "http://central. JDT Selecting this group captures all configuration under the "Java" category from the Eclipse preferences. Figure 11.. When the MSE Installer materializes a new Eclipse installation it will download a settings. “Configuring Eclipse Preferences for a Codebase” by clicking on the Select.12.12. After configuring a codebase to publish Eclipse settings. Publishing Eclipse Preferences The MSE Codebase editor can capture your Eclipse preferences and publish them to a Nexus repository manager.example.org/nexus/server/local/templates/settings/default/ content".11. “Configuring Codebase Resources”. Nexus Team Edition and Nexus Professional Edition provide you with the ability to store and managed Maven Settings files for developers. select "Export workspace preferences" and select all of the preference categories you want to publish in this MSE Codebase. Configuring Eclipse Preferences for a Codebase 11.11. profiles. When the Codebase is published to Nexus Team edition.5.m2/settings. The available preferences categories: PROXY Proxy configuration captures proxy configuration under General -> Network Connections from the Eclipse preferences.. The most common scenarios for using an existing. this preferences JAR file will be published to the repository manager and associated with the published MSE Codebase. the ${baseurl} will be replaced with "http://central.xml from the Template URL and interpolate that template with two substitution variables: ${baseurl} This is the Base URL for the Nexus server responsible for delivering the Maven Settings template. This file contains credentials. external URL is when an MSE Codebase is referencing Eclipse preferences from another MSE Codebase.xml. M2E Selecting this group captures all configuration under the "Maven" category from the Eclipse preferences.org/nexus/". Publishing Maven Settings An important component of Maven configuration is a Maven Settings file usually stored in ~/.5. save your Codebase and you should see a file named mse-codebasepreferences. You can associate an MSE Codebase with a set of previous published Eclipse preferences by selecting "External URL" and supplying the URL to a set of Eclipse preferences. you should supply the Template URL to the MSE Codebase editor.jar associated with the MSE Codebase in the Project Explorer. 96 .1. button in Figure 11. and preferences which can use used to customize configuration variables for individual developers.

sonatype.7. Managing Codebase Source Trees A Source Tree is a location in source control which corresponds to one or more projects in an Eclipse environment. button next to the Source Trees section of the Codebase editor as shown in Figure 11. 3 4 http://www.com/books/nexus-book/reference/security. Setting Codebase Prerequisites The Codebase editor contains a section to configure prerequisites. Figure 11. If your MSE Code contains a security realm for Nexus. Figure 11. Configuring Codebase Information To learn more about using Nexus Professional to manage and distribute Maven Settings.10.html http://www. Configuring Codebase Prerequisites 11.xml template will be replaced with the username supplied to the MSE Installer for the Nexus realm. click on the Create.15. “Configuring Codebase Source Trees”. Figure 11. To add a new Source Tree.14.html 97 . you would supply the URL listed in the Template URL column to the MSE Codebase editor. “Configuring Codebase Prerequisites” allows you to configure the validation criteria which must be satisfied before the MSE Installer will materialize a codebase.14. 11. The MSE Installer will test the workstation to see if it has sufficient memory to perform a materialization. The Required Memory field shown in Figure 11.com/books/nexus-book/reference/security. “Configuring Codebase Information” shows the Maven Settings configuration panel from Nexus Team Edition.13. read "Managing Maven Settings"3 chapter in Repository Management with Nexus4. To configure an MSE Codebase to download the "enterprise-webapp-team" Maven Settings template.${userId} This is the user identifier for the user making the request for Maven Settings.6..sonatype. this ${userId} value in a settings.

contains the list of all realms used throughout an MSE Codebae. 98 . consider the example illustrated in Figure 11.9. Create security realms for each resource that requires a separate set of credentials. “Adding a New Security Realm”. “Two Codebases with an Overlapping Source Tree”.. button shown in Figure 11. The Realms section of the Codebase Overview. another codebase is used by a team which develops a client-side application written in Swing. click on the Create. and both teams maintain a separate Subversion repository which contains team-specific code. Figure 11. Configuring Codebase Realms To add a new Security Realm to a Codebase.15.18.17.16.16.8. Figure 11. Both teams use a common library. A Source Tree is a location in source control containing one or more Maven projects. “Configuring Codebase Realms” and supply a new name for the Security Realm in the dialog shown in Figure 11.Figure 11. To illustrate the relationship between a Codebase and a Source Tree. Each team would have a custom MSE Codebase with two Source Trees. and both of these codebases would include a Source Tree for the Common Library project. Eclipse will then present you with a confirmation dialog to make sure that you really want to delete the selected Source Tree.17. Configuring Codebase Source Trees To delete a Source Tree from an MSE Codebase. Configuring Codebase Security Each Codebase is associated with one or more Security Realms. Adding a New Security Realm 11. Configuring a Source Tree Every MSE Codebase can contain one or more Source Trees.16.. The MSE Installer stores credentials in secure storage in Security Realms. select the Codebase in the Source Trees section of the MSE Codebase editor and click on the Delete button. “Configuring Codebase Realms”. 11. A company has two MSE Codebases: one codebase is used by a team which develops a web application. as shown in Figure 11.

If there are no Source Trees to edit.19.am Te se a ng wi deb S Co Swing App We Co b Te de am ba se Web App Common Library Figure 11. The Source Tree editor is shown in Figure 11.19. Configuring an MSE Codebase Source Tree 99 . “Codebase Overview”.18. create a Source Tree by following the directions in Section 11.7. go to the Codebase Overview. and click on one of the Source Tree tabs below the Codebase Overview as shown in Figure 11. “Managing Codebase Source Trees”. Two Codebases with an Overlapping Source Tree To open the Source Tree editor. “Configuring an MSE Codebase Source Tree”.8. Figure 11.

10. Figure 11. Adding a New Feed URL The Source Tree editor allows you to add feeds which will be made available to developers working with this materialized MSE Codebase.22. open the Codebase Overview and click on the Publish button shown in Figure 11. type in the name of the profile you want activated into the dialog shown in Figure 11.11. Codebase Publish Button Clicking the Publish button will show the Publish Codebase Descriptor dialog shown in Figure 11.20.1.20.2. “Codebase Publish Button”. Adding a Maven Profile 11. “Configuring an MSE Codebase Source Tree”. This dialog contains the URL and credentials that Maven Studio for Eclipse will use to connect to Nexus Team Edition. Adding a Maven Profile The Source Tree editor allows you to add a Maven Profile which will be made active for every project in a particular Source Tree. 100 . Figure 11. “Configuring an MSE Codebase Source Tree”. To add a new Feed URL.22. “Adding a Maven Profile”. Once you click create. click on Create in the Feed section of the Source Tree Overview shown in Figure 11. “Publish Codebase Dialog”.19.9.21. To add a new Maven Profile to a Source Tree.19. Adding a New Feed URL 11. click on the Create button in th Profiles section of the Source Tree Overview shown in Figure 11. Publishing an MSE Codebase to Nexus Team Edition An MSE Codebase is published to Nexus Team Edition where it is then made available to clients for materialization. Clicking on the Publish button in this dialog will then cause Maven Studio for Eclipse to connect to Nexus Team Edition and transfer the codebase to Nexus Team Edition.9.23. Figure 11. To publish an MSE Codebase.

23. Publish Codebase Dialog 101 .Figure 11.

.

Creative Commons BY-NC-ND 3. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.0 US License Creative Commons Attribution-NonCommercial-NoDerivs 3.0/us/legalcode .0 license for the specific jurisdiction. you must include the following link with the URL in the about attribute listed on a single line (remove the backslashes and join all URL parameters): <div xmlns:cc="http://creativecommons. For more information about this license.org/licenses/by-nc-nd/3.com%2Fbook\ &lang=en_US&language=en_US&n_questions=3"> <a rel="cc:attributionURL" property="cc:attributionName" href="http://www.0/us/"> CC BY-NC-ND 3.sonatype. THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. Creative Commons License This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3. copy.</a> / <a rel="license" href="http://creativecommons.1. distribute.0 United States license.org/international. Inc.com\ &field_sourceurl=http%3A%2F%2Fwww.0 license available from http:// creativecommons. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT. If the Creative Commons Attribution-Noncommercial-No Derivative Works version 3. • You may not use this work for commercial purposes. You are free to share. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE. If no ported version of the Creative Commons license exists for a particular jurisdiction. this work shall be covered by the generic. • You may not alter. If you redistribute this work on a web page.org/licenses/by-nc-nd/3.sonatype. A comprehensive list of jurisdictions for which a Creative Commons license is available can be found on the Creative Commons International web site at http://creativecommons.org/ns#" about="http://creativecommons.\ &field_attribute_to_url=http%3A%2F%2Fwww. A. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. 1 http://creativecommons.0 United States1 THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). this work shall be covered under the Creative Commons Attribution-Noncommercial-No Derivate Works version 2. or build upon this work.com">Sonatype.0</a> </div> When downloaded or distributed in a jurisdiction other than the United States of America. YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. see http://creativecommons. transform.org/licenses/by-nc-nd/3. and perform the work under the following conditions: • You must attribute the work to Sonatype.org/license/results-one?q_1=2&q_1=1\ &field_commercial=n&field_derivatives=n&field_jurisdiction=us\ &field_format=StillImage&field_worktitle=Repository%3A+\Management\ &field_attribute_to_name=Sonatype%2C+Inc.0/.com.0 license is not available for a specific jurisdiction.Appendix A. Inc. with a link to http://www. display.org/licenses/by-nc-nd/3. unported Creative Commons Attribution-Noncommercial-No Derivative Works version 3.sonatype.sonatype.0/us/. this work shall be covered by the appropriate ported version of Creative Commons Attribution-Noncommercial-No Derivative Works 3.5 license for the jurisdiction in which the work was downloaded or distributed.

and You must include a copy of. to distribute copies or phonorecords of. royalty-free. "Derivative Work" means a work based upon the Work or upon the Work and other pre-existing works. Nothing in this license is intended to reduce. "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of a recipient of the Work to exercise the rights granted to that recipient under the terms of the License. The exchange of the Work for other copyrighted 104 . nonexclusive. or publicly digitally perform. condensation. remove from the Collective Work any credit as required by Section 4(c). publicly display. f. publicly display. perform publicly. such as a translation. You may distribute. b. transformed. limit. individuals. where the Work is a musical composition or sound recording. sound recording. When You distribute. and. but otherwise you have no rights to make Derivative Works. publicly perform. to reproduce the Work. e. as requested. This Section 4(a) applies to the Work as incorporated in a Collective Work. or adapted. musical arrangement. motion picture version. such as a periodical issue. in which the Work in its entirety in unmodified form. first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws. along with one or more other contributions. Fair Use Rights. "Collective Work" means a work. anthology or encyclopedia. or publicly digitally perform the Work only under the terms of this License. fictionalization. Restrictions. abridgment. publicly perform. individuals. entity or entities who created the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. or any other form in which the Work may be recast. b. but this does not require the Collective Work apart from the Work itself to be made subject to the terms of this License. Subject to the terms and conditions of this License. Definitions a. publicly display. art reproduction. entity or entities that offers the Work under the terms of this License. All rights not expressly granted by Licensor are hereby reserved. constituting separate and independent works in themselves. 2. You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. to the extent practicable. or publicly digitally perform the Work. this License with every copy or phonorecord of the Work You distribute. You may not sublicense the Work. b. dramatization. publicly perform. including but not limited to the rights set forth in Sections 4(d) and 4(e). display publicly. upon notice from any Licensor You must. and to reproduce the Work as incorporated in the Collective Works. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License. 4. and perform publicly by means of a digital audio transmission the Work including as incorporated in Collective Works. c. License Grant. 3. "Licensor" means the individual. to incorporate the Work into one or more Collective Works. For the avoidance of doubt. or restrict any rights arising from fair use. except that a work that constitutes a Collective Work will not be considered a Derivative Work for the purpose of this License. perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: a.1. The above rights may be exercised in all media and formats whether now known or hereafter devised. You may not impose any technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. the synchronization of the Work in timed-relation with a moving image ("synching") will be considered a Derivative Work for the purpose of this License. d.The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: a. are assembled into a collective whole. If You create a Collective Work. Licensor hereby grants You a worldwide. "Original Author" means the individual. "Work" means the copyrightable work of authorship offered under the terms of this License. or the Uniform Resource Identifier for.

105 . INCIDENTAL.g. royalties for any phonorecord You create from the Work ("cover version") and distribute. subject to the compulsory license created by 17 USC Section 115 of the US Copyright Act (or the equivalent in other jurisdictions). Performance Royalties Under Blanket Licenses. the Uniform Resource Identifier. terms of service or by other reasonable means. For the avoidance of doubt. Representations. Licensor and/or Attribution Parties. that Licensor specifies to be associated with the Work.g.g. EXPRESS. that in the case of a Collective Work. OR THE PRESENCE OF ABSENCE OF ERRORS.g. IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL. webcast) of the Work. Mechanical Rights and Statutory Royalties. For the avoidance of doubt. webcast) of the Work if that performance is primarily intended for or directed toward commercial advantage or private monetary compensation. FITNESS FOR A PARTICULAR PURPOSE. INCLUDING. reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym. a sponsor institute. if a credit for all contributing authors of the Collective Work appears. SO SUCH EXCLUSION MAY NOT APPLY TO YOU. OR THE ABSENCE OF LATENT OR OTHER DEFECTS. ASCAP. Licensor and/or Attribution Parties. WITHOUT LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES. LICENSOR OFFERS THE WORK AS-IS AND ONLY TO THE EXTENT OF ANY RIGHTS HELD IN THE LICENSED WORK BY THE LICENSOR. provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works. d. without the separate. The credit required by this Section 4(c) may be implemented in any reasonable manner. if applicable) if supplied. If You distribute. Licensor reserves the exclusive right to collect. or publicly digitally perform the Work (as defined in Section 1 above) or Collective Works (as defined in Section 1 above). WHETHER OR NOT DISCOVERABLE. to the extent reasonably practicable. as appropriate. ii. Harry Fox Agency). Licensor reserves the exclusive right to collect. Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING. whether individually or via a performance-rights society (e. subject to the compulsory license created by 17 USC Section 114 of the US Copyright Act (or the equivalent in other jurisdictions).works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation. then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. publishing entity. via that society. PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK. keep intact all copyright notices for the Work and provide. unless a request has been made pursuant to Section 4(a). WARRANTIES OF TITLE. Licensor reserves the exclusive right to collect whether individually or. SoundExchange). BMI. For the avoidance of doubt. publicly perform. if Your distribution of such cover version is primarily intended for or directed toward commercial advantage or private monetary compensation. You may only use the credit required by this clause for the purpose of attribution in the manner set out above and. 5. NONINFRINGEMENT. c. CONSEQUENTIAL. THE LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK. sponsorship or endorsement by the Original Author. publicly display. if Your public digital performance is primarily intended for or directed toward commercial advantage or private monetary compensation. SESAC). by exercising Your rights under this License. MARKETABILITY. journal) for attribution ("Attribution Parties") in Licensor's copyright notice. Limitation on Liability. in the event that Licensor is a member of a performance rights society (e. at a minimum such credit will appear. e. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW. the title of the Work if supplied. royalties for the public digital performance (e. of You or Your use of the Work. and/or (ii) if the Original Author and/or Licensor designate another party or parties (e. whether individually or via a music rights agency or designated agent (e.g. unless such URI does not refer to the copyright notice or licensing information for the Work. MERCHANTIBILITY. however. IMPLIED.g. where the Work is a musical composition: i. Webcasting Rights and Statutory Royalties. EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. provided. You may not implicitly or explicitly assert or imply any connection with. royalties for the public performance or public digital performance (e. if any. express prior written permission of the Original Author. You must. where the Work is a sound recording. ACCURACY. 6. STATUTORY OR OTHERWISE. the name of such party or parties.

7. There are no understandings. Any permitted use will be in compliance with Creative Commons' thencurrent trademark usage guidelines. provided. granted under the terms of this License). however that any such election will not serve to withdraw this License (or any other license that has been. Creative Commons Notice Creative Commons is not a party to this License. or is required to be. special. Notwithstanding the above. such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. Termination a. This License constitutes the entire agreement between the parties with respect to the Work licensed here. Sections 1. and makes no warranty whatsoever in connection with the Work. it shall have all rights and obligations of Licensor. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. Individuals or entities who have received Collective Works (as defined in Section 1 above) from You under this License. this trademark restriction does not form part of this License. 106 . Notwithstanding the foregoing two (2) sentences. 7. agreements or representations with respect to the Work not specified here. the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. and 8 will survive any termination of this License. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time. and this License will continue in full force and effect unless terminated as stated above. and without further action by the parties to this agreement. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. Each time You distribute or publicly digitally perform the Work (as defined in Section 1 above) or a Collective Work (as defined in Section 1 above). Subject to the above terms and conditions. 6. Creative Commons may be contacted at http://creativecommons. If any provision of this License is invalid or unenforceable under applicable law. the license granted here is perpetual (for the duration of the applicable copyright in the Work). 8. Miscellaneous a.org/. Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL. if Creative Commons has expressly identified itself as the Licensor hereunder. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever. as may be published on its website or otherwise made available upon request from time to time. 5. will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. b. 2. however. For the avoidance of doubt. it shall not affect the validity or enforceability of the remainder of the terms of this License. Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. c. b. including without limitation any general. d. incidental or consequential damages arising in connection to this license.

3. (MEBOOK-507) • Chapter 2.8 on February 15. (MEBOOK-3217) • Added the full text of the Creative Commons license to the front matter. Changes in Edition 0. “Installing the Web Tools Platform (WTP)” (MEBOOK-544) • Added Section 2. (MEBOOK-2013) • Automated the production of print and web figures. (MEBOOK-3318) • Fixed a typo: redundant mention of Subversion in Section 3. (MEBOOK-409) B.6 on September 15.7 The following changes were introduced in Edition 0.2 which had a different approach to installing Eclipse plugins.10. Installing m2eclipse to provide instructions for an Eclipse 3. 2010: • Updated book to cover m2eclipse 0.1.5 plugin installation. (MEBOOK-1219) .2.3.1. (MEBOOK-1816) • Assigned the book an ISBN.2.3. Changes in Edition 0. “Installing Subclipse” (MEBOOK-522) • Updated Section 2. (MEBOOK-558) B.1. “Installing the Eclipse IDE” (MEBOOK-575) • Update Chapter 2. 2009: • Created a new chapter Chapter 3.444" x 9.3.6 The following changes were introduced in Edition 0. Book Revision History The following sections list changes made to the book in reverse chronological order starting with 1. (MEBOOK-2314) • Standardized on 0.3. 2009: • Modified project to generate a PDF for pre-print: • Embedded the fonts in the generated PDF. (MEBOOK-2215) • Added the appropriate roles to all imageobjects. Changes in Edition 0.Appendix B. B.1.3.3. (MEBOOK-1710) • Resized book to Royal Quarto (7.1. (MEBOOK-566) • Removed reference to AJDT support. Installing m2eclipse now discusses the Core and Extras update sites.5" Margins. (MEBOOK-2112) • Added a blank page to the end of the PDF.7 on November 16. “Installing Mylyn” (MEBOOK-533) • Updated Section 2. Creating and Importing Projects.0.3. (MEBOOK-491) • Updated Section 2.1.8 The following changes were introduced in Edition 0.681"). “Checking Out a Maven Project from SCM”. (MEBOOK-1611) • Added a Title Page to the PDF. The initial versions of this book discuss Eclipse 3.

“Resolving Dependencies”. “Using the Form-based POM Editor”.1.2. (MEBOOK-2525) 108 .5 PDF: • Fixed a typo: removed duplicate "about" from page 29.• Fixed a typo: capitalized "eclipse" in Section 8. (MEBOOK-920) • Added clarification about the availability of the Form-based POM Editor to Section 8. (MEBOOK-821) • Added new section about the Maven Repository view: ???.3. (MEBOOK-2823) • Removed extraneous space from page 28: (MEBOOK-2924) • Fixed a spelling error on page 51. (MEBOOK-1922) • Address feedback from Proofread of Edition 0.

Index .