Book Image

Maven for Eclipse

By : Sanjay Shah
Book Image

Maven for Eclipse

By: Sanjay Shah

Overview of this book

<p>Starting with an exploration of the Maven architecture and its installation, you will then learn how to install m2eclipse, which provides Maven integration with Eclipse. Furthermore, the book guides you through the stages of project creation, including building, testing, and executing the projects.</p> <p>You will learn to customize your projects by demonstrating different core concepts of the Maven project structure. Nevertheless, you will also become familiar with the build lifecycles that generate the required artifacts. Moreover, it will also guide you through the process of handling multimodule projects and working with them effectively.</p> <p>By the end of this book, you will have a good understanding of m2eclipse and will be able to use it efficiently with ease.</p>
Table of Contents (14 chapters)
Maven for Eclipse
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Maven for Eclipse is an indispensable guide to help you understand and use Maven from within Eclipse IDE using the m2eclipse plugin. By no means is it an in-depth and comprehensive resource. Rather, it's a quick and handy guide toward Maven project's development. It starts with the basics of Apache Maven; covers core concepts; and shows you how to create, import, build, run, package, and customize to generate project artifacts of Maven projects using the m2eclipse plugin inside the Eclipse IDE.

What this book covers

Chapter 1, Apache Maven – Introduction and Installation, provides users with a quick introduction and installation reference to Apache Maven. By the end of this chapter, users will have a Maven project running on their systems.

Chapter 2, Installing m2eclipse, serves as a reference for users to install the m2eclipse plugin and also provides Maven integration for Eclipse. By the end of this chapter, users will have m2eclipse installed on their systems and ready to be used.

Chapter 3, Creating and Importing Projects, starts with the Maven project structure, introduces core aspects and concepts, and guides you toward creating and importing Maven projects using the m2eclipse plugin. By the end of this chapter, users will be familiar with the core concepts of the Maven project structure, and they'll be able to create and import Maven projects.

Chapter 4, Building and Running a Project, introduces users to different build lifecycles and teaches them how to view the m2eclipse console and build and run projects. By the end of this chapter, users will be familiar with the build lifecycle and will be competent at building and running projects using m2eclipse.

Chapter 5, Spicing Up a Maven Project, teaches users to create a simple web application, shows ways to customize it, and provides guides on how to write and run unit tests. By end of this chapter, users will learn to create web applications using m2eclipse and change the POM file to generate reports against unit tests.

Chapter 6, Creating a Multimodule Project, intends to introduce the concept of multimodule projects and teaches users to create, build, and run the project. At the end of this chapter, users will know how to create and run a multimodule Maven project using the m2eclipse plugin.

Chapter 7, Peeking into m2eclipse, dives into the m2eclipse plugin and introduces different features and aspects that makes life easier. By the end of this chapter, users will be familiar with every aspect of m2eclipse and will be able to use it efficiently and with ease.

What you need for this book

It is recommended that you have a laptop or a desktop with the following specifications for the best performance during development:

  • 4 GB RAM

  • Windows OS 7 / Ubuntu 12.04 / Mac OS Maverick

  • Dual core / iSeries processor

  • Internet connection

Who this book is for

This book is aimed at beginners and existing developers who want to learn how to use Maven for Java projects. It is assumed that you have experience in Java programming and that you have used an IDE for development.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Plugins and goals can be included declaratively in the pom file to customize the execution of a project."

A block of code is set as follows:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.packt.mvneclipse</groupId>
    <artifactId>mvneclipse</artifactId>
    <version>1.2</version>
</project>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<!--General project Information -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.packt.mvneclipse</groupId>
  <artifactId>hello-project</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>hello-project</name>
  <url>http://maven.apache.org</url>
  <properties>1
  <project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
</properties>

<repositories>
  <repository>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
    <id>central</id>
    <name>Maven Repository Switchboard</name>
    <url>http://repo1.maven.org/maven2</url>
  </repository>
</repositories>

Any command-line input or output is written as follows:

set PATH =%PATH%;%M2_HOME%\bin

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "To make m2eclipse use the external Maven, navigate to Window | Preference in Eclipse, and the Preference window appears."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.