1 package org.apache.maven.plugin.jar;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.File;
23
24 /**
25 * Build a JAR from the current project.
26 *
27 * @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
28 * @version $Id: JarMojo.java 740305 2009-02-03 13:59:02Z bentmann $
29 * @goal jar
30 * @phase package
31 * @requiresProject
32 * @requiresDependencyResolution runtime
33 */
34 public class JarMojo
35 extends AbstractJarMojo
36 {
37 /**
38 * Directory containing the classes and resource files that should be packaged into the JAR.
39 *
40 * @parameter expression="${project.build.outputDirectory}"
41 * @required
42 */
43 private File classesDirectory;
44
45 /**
46 * Classifier to add to the artifact generated. If given, the artifact will be an attachment instead.
47 *
48 * @parameter
49 */
50 private String classifier;
51
52 protected String getClassifier()
53 {
54 return classifier;
55 }
56
57 /**
58 * @return type of the generated artifact
59 */
60 protected String getType()
61 {
62 return "jar";
63 }
64
65 /**
66 * Return the main classes directory, so it's used as the root of the jar.
67 */
68 protected File getClassesDirectory()
69 {
70 return classesDirectory;
71 }
72 }