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 1158941 2011-08-17 22:22:17Z rfscholte $
29 * @goal jar
30 * @phase package
31 * @requiresProject
32 * @threadSafe
33 * @requiresDependencyResolution runtime
34 */
35 public class JarMojo
36 extends AbstractJarMojo
37 {
38 /**
39 * Directory containing the classes and resource files that should be packaged into the JAR.
40 *
41 * @parameter default-value="${project.build.outputDirectory}"
42 * @required
43 */
44 private File classesDirectory;
45
46 /**
47 * Classifier to add to the artifact generated. If given, the artifact will be an attachment instead.
48 *
49 * @parameter
50 */
51 private String classifier;
52
53 protected String getClassifier()
54 {
55 return classifier;
56 }
57
58 /**
59 * @return type of the generated artifact
60 */
61 protected String getType()
62 {
63 return "jar";
64 }
65
66 /**
67 * Return the main classes directory, so it's used as the root of the jar.
68 */
69 protected File getClassesDirectory()
70 {
71 return classesDirectory;
72 }
73 }