The Maven Cookbook

Maven Cookbook

Maven Cookbook

Tim O'Brien

Stuart McCulloch

Brian Demers


Maven Cookbook is a Cookbook about Apache Maven.

Foreword: 0.5-SNAPSHOT
1. Changes in Edition 0.4
1. Cooking with Maven and OSGi
1.1. Introduction
1.2. Generating an OSGi Project with Maven
1.3. Starting an OSGi Container
1.4. Importing OSGi Bundles with Maven
1.5. Creating an OSGi Bundle with Maven
1.6. Starting an Alternative OSGi Framework (Knopflerfish)
1.7. Starting an Alternative OSGi Framework (Equinox)
1.8. Deploying OSGi Bundles to a Maven Repository
1.9. Transforming a Maven Repository into an OSGi Bundle Repository
1.10. Proxying OSGi Bundle Repositories
1.11. Grouping OSGi Bundle Repositories
2. Groovy Maven
2.1. Introduction
2.2. Running an Inline Groovy Script in a Maven Build
2.3. Executing Groovy Scripts in a Maven Build
2.4. Writing Plugins in Groovy
3. Scala and Maven
3.1. Introduction
3.2. Running an Inline Scala Script in a Maven Build
3.3. Running an External Scala Script in a Maven Build
4. Ant and Maven
4.1. Introduction
4.2. Running an Inline Ant Script in a Maven Build
4.3. Running an External Ant Script in a Maven Build
4.4. Creating an Ant Maven Plugin
5. Ruby and Maven
5.1. Introduction
5.2. Writing Plugins in JRuby
6. Web Development
6.1. Running a Web Application in a Servlet Container
6.2. Configuring a Servlet Container
6.3. Starting a WAR Dependency in a Servlet Container
7. Unit Testing with Maven
7.1. Introduction
7.2. Running JUnit Tests
7.3. Running TestNG Tests
7.4. Running Specific TestNG Test Groups
7.5. Configuring TestNG Tests
7.6. Running TestNG Tests in Parallel
7.7. Skipping Unit Tests
7.8. Running a Single Unit Test
8. Integration Testing with Maven
8.1. Introduction
8.2. Running a Selenium Test
8.3. Running Integration Tests Against a Servlet Container
9. Releasing Software with Maven
9.1. Introduction
9.2. Install Artifact
9.3. Deploying Artifact
9.4. Releasing an Artifact
10. Repository Management
10.1. Installing and Running Nexus Open Source
10.. Proxying a Remote Repository
10.3. Browsing a Nexus Repository
10.4. Configuring a Nexus Repository
10.5. Viewing Summary Information for Nexus Repositories
10.6. Using Mirrors for Proxy Repositories
10.. Grouping Repositories
10.8. Installing Nexus Professional
10.9. Configuring a Staging Repository for Deployment in Nexus Professional
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.3
B.2. Changes in Edition 0.2
B.3. Changes in Edition 0.1.4
B.4. Changes in Edition 0.1.3
B.5. Changes in Edition 0.1.2
B.6. Changes in Edition 0.1.1
B.7. Changes in Edition 0.1

List of Examples

1.1. ExampleService Interface
1.2. ExampleServiceImpl Implementation of the ExampleService Interface
1.3. The BundleActivator implementation: ExampleActivator
1.4. osgi.bnd Bundle Configuration
1.5. settings.xml to configure deployment credentials and mirrors for Nexus
1.6. Distribution Management Settings for the osgi-project Project
1.7. Metadata for the Snapshots OBR Virtual Repository
2.1. Running a Groovy Script from a POM
2.2. Executing External Groovy Scripts in a Maven Build
2.3. The CreateDeps.groovy Script
2.4. The CopySource.groovy Script
2.5. POM for a Groovy Maven Plugin
3.1. Executing an Inline Scala Script with the Maven Scala Plugin
3.2. Configuring the Maven Scala Plugn Script Goal to Execute an External Script
3.3. The CreateDeps.scala Script
4.1. Executing an Inline Ant Script in a Maven Build
4.2. Executing an External Ant Script from a Maven Build
4.3. POM for an Ant Maven Plugin
4.4. Echo Ant Mojo
4.5. Echo Ant Mojo Descriptor
5.1. POM for a JRuby Maven Plugin
5.2. The Echo Ruby Mojo
5.3. Referencing a Maven Project from a Ruby Mojo
5.4. Raising a MojoError from a Ruby Mojo
5.5. Depending on a Plexus Component from a Ruby Mojo
6.1. Simple Form Accepting an Index to Pass to the Fibonacci Servlet
6.2. Fibonacci Servlet which Calculates a Number from the Fibonacci Sequence
6.3. Web Application Descriptor for sample-web
7.1. SeriousComponent class
7.2. JUnit test for SeriousComponent
7.3. TestNG Test for the SeriousComponent
8.1. TwitterTest a Selenium Test written in TestNG
8.2. POM configuring SureFire to Execute Selenium Remote Control