Edition 0.4 Maven Nexus m2eclipse The Maven Cookbook The Maven Cookbook Tim O’Brien Stuart McCulloch Brian Demers 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 prod- ucts 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: For online information and ordering of this and other Sonatype books, please visit www.sonatype.com. The Sonatype, Inc. publisher oers discounts on this book when ordered in 12501 Prosperity Drive quantity. For more information, please contact: Suite 350 [email protected] Silver Spring, MD 20904. ISBN 978-0-9842433-2-7 Editor: Tim O’Brien Nexus Professional Nexus Professional 1.6 is now available with a wide array of new features. This release introduces new staging and repository management capabilities as well as improved permissions management tools. Download your free, 30-day evaluation today. "We have adopted Maven for all our software development projects and have started using Nexus to better support our development processes. The support for promotion and procurement workows in Nexus Professional now expands Nexus with a robust set of additional features which make it easier for us to maintain consistency between our development, testing and production environments." - Chris Maki, Principal Software Engineer, Overstock.com "At Intuit, we recognize that as builds grow and the teams who create them change over time, swift, accurate repository management becomes critical. Nexus provides a comprehensive, easy-to-use open source solution that lets teams and developers track, search, organize and access build components." - Kaizer Sogiawala, Software Conguration Management Engineer, Intuit. http://www.sonatype.com/products/nexus Maven Training by Sonatype With Sonatype training, you will learn Maven fundamentals and best practices directly from Maven and Nexus experts. If your team is using Nexus, this class is the easiest way to make sure that everyone starts from the same foundation. MVN-101 Maven Mechanics An online instructor-led course of two half-day sessions, ideal for programmers who work with Maven projects and need to understand how to work with an existing Maven build. This class is also appropriate for experienced Maven users who are inter- ested in becoming more familiar with Maven fundamentals. MVN-201 Development Infrastructure Design An online instructor-led course of two half-day sessions, ideal for Development Infra- structure Engineers who are responsible for maintaining enterprise development infra- structure. This class includes content on advanced repository management using Nexus and continuous integration using Hudson. http://www.sonatype.com/training Copyright ............................................................................................................................................................ ix Foreword: 0.5-SNAPSHOT .................................................................................................................................... xi 1. Changes in Edition 0.4 ............................................................................................................................... xi 1. Cooking with Maven and OSGi ............................................................................................................................ 1 1.1. Introduction ............................................................................................................................................ 1 1.2. Generating an OSGi Project with Maven ..................................................................................................... 1 1.3. Starting an OSGi Container ....................................................................................................................... 3 1.4. Importing OSGi Bundles with Maven ......................................................................................................... 5 1.5. Creating an OSGi Bundle with Maven ........................................................................................................ 9 1.6. Starting an Alternative OSGi Framework (Knopflerfish) ............................................................................... 13 1.7. Starting an Alternative OSGi Framework (Equinox) ..................................................................................... 15 1.8. Deploying OSGi Bundles to a Maven Repository ........................................................................................ 16 1.9. Transforming a Maven Repository into an OSGi Bundle Repository ................................................................ 21 1.10. Proxying OSGi Bundle Repositories ........................................................................................................ 24 1.11. Grouping OSGi Bundle Repositories ....................................................................................................... 29 2. Groovy Maven ................................................................................................................................................. 33 2.1. Introduction .......................................................................................................................................... 33 2.2. Running an Inline Groovy Script in a Maven Build ...................................................................................... 33 2.3. Executing Groovy Scripts in a Maven Build ............................................................................................... 35 2.4. Writing Plugins in Groovy ...................................................................................................................... 36 3. Scala and Maven .............................................................................................................................................. 39 3.1. Introduction .......................................................................................................................................... 39 3.2. Running an Inline Scala Script in a Maven Build ........................................................................................ 39 3.3. Running an External Scala Script in a Maven Build ..................................................................................... 41 4. Ant and Maven ................................................................................................................................................ 45 4.1. Introduction .......................................................................................................................................... 45 4.2. Running an Inline Ant Script in a Maven Build ........................................................................................... 45 4.3. Running an External Ant Script in a Maven Build ....................................................................................... 46 4.4. Creating an Ant Maven Plugin ................................................................................................................. 47 5. Ruby and Maven .............................................................................................................................................. 51 5.1. Introduction .......................................................................................................................................... 51 5.2. Writing Plugins in JRuby ........................................................................................................................ 51 6. Web Development ............................................................................................................................................ 57 6.1. Running a Web Application in a Servlet Container ...................................................................................... 57 6.2. Configuring a Servlet Container ..............................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages123 Page
-
File Size-