1 /*******************************************************************************
2 * Copyright (c) 2011 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * and Apache License v2.0 which accompanies this distribution.
6 * The Eclipse Public License is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 * The Apache License v2.0 is available at
9 * http://www.apache.org/licenses/LICENSE-2.0.html
10 * You may elect to redistribute this code under either of these licenses.
11 *******************************************************************************/
12 package org.sonatype.plugins.sisu;
13
14 import java.io.File;
15
16 import org.apache.maven.plugin.AbstractMojo;
17 import org.apache.maven.project.MavenProject;
18
19 /**
20 * Generates a qualified class index for test classes compiled by the current project.
21 *
22 * @goal test-index
23 * @phase process-test-classes
24 * @requiresDependencyResolution test
25 */
26 public class TestIndexMojo
27 extends AbstractMojo
28 {
29 // ----------------------------------------------------------------------
30 // Implementation fields
31 // ----------------------------------------------------------------------
32
33 /**
34 * The Maven project to index.
35 *
36 * @parameter expression="${project}"
37 * @required
38 * @readonly
39 */
40 private MavenProject project;
41
42 // ----------------------------------------------------------------------
43 // Public methods
44 // ----------------------------------------------------------------------
45
46 public void execute()
47 {
48 final IndexMojo mojo = new IndexMojo();
49 mojo.setLog( getLog() );
50 mojo.setProject( project );
51 mojo.setOutputDirectory( new File( project.getBuild().getTestOutputDirectory() ) );
52 mojo.execute();
53 }
54 }