Developing with Eclipse and Maven

Authors

Tim O'Brien
Jason Van Zyl
Benjamin Bentmann
Igor Fedorenko
Brian Fox
Milos Kleint
Peter Lynch
Matthew Piggott
Dmitry Platonoff
Pascal Rapicault
Rich Seddon
Vlad Tatavu
Dan Yocum
Tim O'Brien
Sonatype, Inc.

Abstract

Sonatype's m2eclipse plugin provides first-class support for Maven projects in the Eclipse IDE. This book covers m2eclipse as well as Sonatype's Maven Studio for Eclipse.


Copyright
Foreword: 1.1
1. Changes in Edition 1.1
2. Changes in Edition 1.0
I. Sonatype m2eclipse
1. Introduction to m2eclipse
1.1. Introduction
1.2. m2eclipse
2. Installing m2eclipse
2.1. Installing the Eclipse IDE
2.2. Installing m2eclipse in Eclipse 3.6 (Helios) with the Eclipse Marketplace
2.2.1. Installing Maven Integration for Eclipse (Core)
2.2.2. Installing Maven Integration for Eclipse (Extras) Prerequisites
2.2.2.1. Installing Subclipse in the Eclipse Marketplace
2.2.2.2. Installing Mylyn in the Eclipse Marketplace
2.2.3. Installing Maven Integration for Eclipse (Extras)
2.3. Installing m2eclipse in Eclipse 3.5 (Gallileo)
2.3.1. Installing m2eclipse Core Components
2.3.2. Installing m2eclipse Extras
2.3.3. Installing Optional Prerequisites
2.3.3.1. Installing Subclipse
2.3.3.2. Installing Mylyn
2.3.3.3. Installing the Web Tools Platform (WTP)
2.4. Uninstalling m2eclipse from Eclipse 3.6 (Helios) with the Eclipse Marketplace
3. Creating and Importing Projects
3.1. Creating a Maven Project
3.1.1. Checking Out a Maven Project from SCM
3.1.2. Creating a Maven Project from a Maven Archetype
3.1.3. Creating a Maven Module
3.2. Create a Maven POM File
3.3. Importing Maven Projects
3.3.1. Importing a Maven Project
3.3.2. Materializing a Maven Project
4. Running Maven Builds
4.1. Enabling the Maven Console
4.2. Running Maven Builds
5. m2eclipse Preferences
5.1. Maven Preferences
6. Working with Maven Repositories
6.1. Working with Maven Repositories
6.2. Searching For Maven Artifacts and Java classes
6.3. Indexing Maven Repositories
6.4. Browsing and Manipulating Maven Repositories
6.4.1. Opening the Maven Repository View
6.4.2. Browsing Global Repositories
6.4.3. Browsing Your Workspace Repository
6.4.4. Browsing a Project Repository
6.4.5. Browsing Your Local Repository
6.4.6. Manipulating a Repository Index
7. Using m2eclipse
7.1.
7.1.1. Adding and Updating Dependencies and Plugins
7.1.2. Downloading Source
7.1.3. Opening Project Pages
7.1.4. Resolving Dependencies
7.2. Analyzing Project Dependencies in m2eclipse
8. Using m2eclipse
8.1. Working with Maven Projects
8.1.1. Downloading Source
8.1.2. Opening Project Pages
8.1.3. Resolving Dependencies
8.2. Using the Form-based POM Editor
8.3. Summary
II. Maven Studio for Eclipse
9. Introduction to Maven Studio for Eclipse
9.1. Introduction
9.2. Developer Onboarding
9.2.1. The Cost of New Developer Onboarding
9.2.2. Onboarding with Maven Studio for Eclipse: Productive on Day One
9.2.3. Managing Developer Workspace Complexity
9.3. Managing Change in Development Environments
9.3.1. The Common Scenario: Upgrading Development Infrastructure
9.3.2. Disadvantages of a High-Risk Development Environment
9.3.3. Advantages of a Low-risk Development Environment
9.4. Consolidating Project Feeds
9.4.1. Simple Scenario: Aggregating a Project's Feeds
9.4.2. Complex Scenarios: Mixed Open/Commercial Development
10. Maven Studio for Eclipse Quickstart
10.1. Introduction
10.1.1. What is a Codebase?
10.1.2. What is a Lineup?
10.1.3. What is a Source Tree?
10.1.4. What is a Source Tree Root?
10.1.5. Use Case for a Build Engineer
10.2. Getting Started with Maven Studio for Eclipse
10.2.1. Nexus Team Edition Prerequisites
10.2.2. Workstation Prerequisites
10.3. Installing Nexus Team Edition
10.3.1. Download Nexus Team Edition
10.3.2. Unpack Nexus Team Edition
10.3.3. Start Nexus Team Edition
10.3.4. Login as a Nexus Administrator
10.4. Configure Nexus Team Server
10.4.1. Open the Nexus Server Configuration Panel
10.4.2. Configure Proxy Settings
10.4.3. Save the Nexus Server Configuration
10.4.4. Add a New P2 Proxy Repository
10.4.5. Configure the New Proxy Repository
10.5. Run the Publish Lineups Scheduled Task in Nexus Team Server
10.5.1. Execute a Scheduled Task for P2 Lineups
10.5.2. Verify P2 Lineups are Published
10.6. Materialize a Sample Workspace
10.6.1. Open the Repositories Panel
10.6.2. Select Nexus Managed Repositories
10.6.3. Select Sonatype MSE Repository
10.6.4. Click on the MSE Installer for the Maven Lineup
10.6.5. Run the MSE Installer
10.6.6. Supply Server and Source Control Credentials
10.6.7. Specify Installation Directories
10.6.8. Verify Completed Eclipse Installation
10.6.9. Configure Password Recovery
10.7. Creating a New MSE Lineup
10.7.1. Create a New MSE Lineup Project
10.7.2. Select the New P2 Lineup Wizard
10.7.3. Configure Nexus and Lineup Coordinates
10.7.4. Select Runtime Platform and Memory
10.7.5. Configure the Contents of the Lineup
10.7.6. Add a New Repository
10.7.7. Add the Checkstyle Plugin Installable Unit
10.7.8. Verify the P2 Lineup
10.8. Configuring a New Codebase
10.8.1. Maximize the Codebase Overview
10.8.2. Create a New Source Tree
10.8.3. Configure the New Source Tree
10.8.4. Configure the SCM Location
10.8.5. Add a Feed URL
10.9. Publishing a Codebase
10.9.1. Publish Your Codebase to Nexus
10.9.2. Supply Nexus Team URL and Credentials
10.9.3. Publish the Codebase
10.10. Materializing a Codebase
10.10.1. Download the Codebase Installer
10.10.2. Supply Apache Subversion Credentials
10.10.3. Supply Nexus Credentials
10.10.4. Configure Materialization Directories
10.10.5. Use Your Materialized Eclipse Installation
10.11. Troubleshooting Codebase Materialization
10.11.1. Reset Subversion Connection
11. Managing MSE Codebases and P2 Lineups
11.1. Introduction
11.2. Creating a MSE Codebase
11.2.1. Creating a New P2 Lineup
11.2.2. Creating a New MSE Codebase
11.3. Configuring a MSE Codebase
11.4. Configuring Codebase Information
11.5. Managing Codebase Resource Locations
11.5.1. Publishing Eclipse Preferences
11.5.2. Publishing Maven Settings
11.6. Setting Codebase Prerequisites
11.7. Managing Codebase Source Trees
11.8. Configuring Codebase Security
11.9. Configuring a Source Tree
11.9.1. Adding a Maven Profile
11.9.2. Adding a New Feed URL
11.10. Publishing an MSE Codebase to Nexus Team Edition
A. Creative Commons License
A.1. Creative Commons BY-NC-ND 3.0 US License
B. Book Revision History
B.1. Changes in Edition 0.8
B.2. Changes in Edition 0.7
B.3. Changes in Edition 0.6
Index

List of Figures

2.1. Opening the Eclipse Marketplace
2.2. Selecting the Eclipse Marketplace
2.3. Selecting Maven Integration for Eclipse from Eclipse Marketplace
2.4. Selecting the Core m2eclipse Feature for Installation
2.5. Agreeing to Software License During m2eclipse Installation
2.6. Ignoring Warning During m2eclipse Installation
2.7. Restarting Eclipse after m2eclipse Installation
2.8. Selecting Subclipse from the Eclipse Marketplace
2.9. Selecting Mylyn from the Eclipse Marketplace
2.10. Selecting Maven Integration for Eclipse (Extras) from the Eclipse Marketplace
2.11. Selecting m2eclipse (Extras) Components to Install
2.12. Agreeing to Software License During m2eclipse (Extras) Installation
2.13. Ignoring Warning During m2eclipse (Extras) Installation
2.14. Restarting Eclipse after m2eclipse (Extras) Installation
2.15. Selecting Maven Integration for Eclipse Components to Uninstall
2.16. Selecting Components to Install for Maven Integration for Eclipse Installation
2.17. Selecting Maven Integration for Eclipse (Extras) Features to Uninstall
2.18. Restarting Eclipse after Uinstallation
3.1. Creating a New Project with m2eclipse Wizards
3.2. Checkout a New Project from Subversion
3.3. Creating a New Project with a Maven Archetype
3.4. Creating a New Maven Module
3.5. Selecting a Parent Project for a New Maven Module
3.6. Creating a New POM
3.7. Adding Dependencies to a New POM
3.8. Querying the Central Repository for Dependencies
3.9. Importing a Maven Project
3.10. Importing a Multi-module Maven Project
3.11. Materializing a Maven Project
3.12. Selecting Artifact to Materialize
3.13. Materializing Apache Camel
4.1. Enabling the Maven Console in Eclipse
4.2. Running an Eclipse build with Run As..
4.3. Configuring a Maven Build as a Run Configuration
5.1. Maven Preferences for Eclipse
5.2. Maven Goal Dialogs
5.3. Maven Installations Preference Page
5.4. Enabling the Maven Version Decorator
5.5. Package Explorer without Maven Version Decorator
5.6. Package Explorer with Maven Version Decorator Enabled
6.1. Searching for Artifacts and Classes
6.2. Searching for a POM
6.3. Searching the Repository for a Class
6.4. Show Maven Indexes View
6.5. Maven Indexes View
6.6. Locating a POM from the Indexes View
6.7. Opening a View in Eclipse
6.8. Selecting the Maven Repositories View in the Show View Dialog
6.9. Browsing a Global Repository
6.10. Browsing the m2eclipse Workspace Repository
6.11. Adding a Repository to a Project's POM
6.12. Project POM with a Custom Repository
6.13. Browsing a Project Repository
6.14. Browsing Your Local Maven Repository
6.15. Updating a Repository Index
7.1. Manually Adding a Dependency to the Project's POM
7.2. Updating Maven Dependencies
7.3. Searching for a Dependency
7.4. Dependency Tree Tab of the POM Editor
7.5. Locating Dependencies in the Dependency Tree
7.6. Viewing the Dependencies of a Project as a Graph
7.7. Radial Layout of Dependency Graph
8.1. Available Maven Features
8.2. Overview Tab of POM Editor for idiom-core
8.3. Overview Tab of POM Editor for idiom Parent Project
8.4. Effective POM for idiom-core
8.5. Dependencies Tab of the POM Editor
8.6. Build Tab of the POM Editor
9.1. A Representative 5-Day, Manual Onboarding
9.2. Minimizing Onboarding Time with Maven Studio for Eclipse
9.3. Consolidating Complexity into Eclipse IDE
9.4. High-risk Development Environments Discourage Change within Constrained Development Cycles
9.5. Low-risk Development Environments Enable Greater Flexibility within Constrained Development Cycles
9.6. Aggregating a Single Project's Feeds
9.7. Aggregating Multiple Project's Feeds
10.1. Maven Studio for Eclipse Codebase Contents
10.2. Maven Studio for Eclipse Interacting with Nexus Team Edition
10.3. Login to Nexus Team Edition
10.4. Opening the Server Configuration Panel
10.5. Opening the Server Configuration Panel
10.6. Adding a New P2 Proxy Repository
10.7. Configuring New Proxy Repository for Checkstyle Plugin
10.8. Opening the Scheduled Tasks Configuration Panel
10.9. Running the P2 Lineup Publishing Task
10.10. Verify the Completion of the P2 Lineup Publishing Task
10.11. Viewing Nexus Managed Repositories
10.12. Selecting the Onboarding Repositories
10.13. Downloading the Demo Maven Installer
10.14. Running the MSE Installer
10.15. Supply Subversion and Source Control Credentials
10.16. Successful Validation of MSE Installer Requirements
10.17. Supplying Installation Directories for MSE Installer
10.18. Maven Projects Displayed in Eclipse
10.19. Creating a Master Password for Eclipse Password Recovery
10.20. Configuring Password Recovery
10.21. Creating a New Lineup Project (Select New -> Other)
10.22. Creating a New Lineup Project (Select New P2 Lineup Wizard)
10.23. Supply Lineup Coordinates and Nexus Credentials
10.24. Select Runtime Platform and Memory
10.25. Configuring Contents of a P2 Lineup
10.26. Adding the Checkstyle Repository to the Lineup Editor
10.27. Adding the Checkstyle Installable Unit to the Lineup Editor
10.28. Verifying the Lineup Summary
10.29. Viewing Your New Codebase in the Eclipse IDE
10.30. Maximizing the Codebase Overview
10.31. Codebase Overview
10.32. Creating a New Source Tree
10.33. Configuring the Commons Source Tree
10.34. Configuring the Commons Feed URL
10.35. Publish Button on Codebase Overview
10.36. Publish Codebase Descriptor
10.37. Published Codebase Descriptor
10.38. Select Published Codebase Descriptor
10.39. Supply Subversion Credentials to MSE Installer
10.40. Supply Nexus Credentials to MSE Installer
10.41. Choosing Installation Directories in the MSE Installer
10.42. A Materialized, Custom, Eclipse Workspace
10.43. Checkstyle View from Materialized Workspae
10.44. Subversion Connect Reset During Materialization
11.1. Selecting the New P2 Lineup Wizard
11.2. Initial Screen of Lineup Wizard: Lineup Setup
11.3. Editing a New P2 Lineup
11.4. Add an Installable Unit to a P2 Lineup
11.5. Add a Repository to a P2 Lineup
11.6. Summary of New P2 Lineup Identifiers
11.7. Selecting the New Codebase Project Wizard
11.8. Codebase Overview
11.9. Codebase Project Files
11.10. Configuring Codebase Information
11.11. Configuring Codebase Resources
11.12. Configuring Eclipse Preferences for a Codebase
11.13. Configuring Codebase Information
11.14. Configuring Codebase Prerequisites
11.15. Configuring Codebase Source Trees
11.16. Configuring Codebase Realms
11.17. Adding a New Security Realm
11.18. Two Codebases with an Overlapping Source Tree
11.19. Configuring an MSE Codebase Source Tree
11.20. Adding a Maven Profile
11.21. Adding a New Feed URL
11.22. Codebase Publish Button
11.23. Publish Codebase Dialog