1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.plugins.dependency.fromDependencies;
20
21 import java.io.File;
22 import org.apache.maven.plugins.annotations.Parameter;
23
24 /**
25 * Abstract Parent class used by mojos that get Artifact information from the project dependencies.
26 *
27 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
28 */
29 public abstract class AbstractFromDependenciesMojo extends AbstractDependencyFilterMojo {
30 /**
31 * Output location.
32 *
33 * @since 1.0
34 */
35 @Parameter(property = "outputDirectory", defaultValue = "${project.build.directory}/dependency")
36 protected File outputDirectory;
37
38 /**
39 * Strip artifact version during copy
40 */
41 @Parameter(property = "mdep.stripVersion", defaultValue = "false")
42 protected boolean stripVersion = false;
43
44 /**
45 * Strip artifact type during copy
46 *
47 * @since 3.4.0
48 */
49 @Parameter(property = "mdep.stripType", defaultValue = "false")
50 protected boolean stripType = false;
51
52 /**
53 * Strip artifact classifier during copy
54 */
55 @Parameter(property = "mdep.stripClassifier", defaultValue = "false")
56 protected boolean stripClassifier = false;
57
58 /**
59 * <p>
60 * Place each artifact in the same directory layout as a default repository.
61 * </p>
62 * <p>
63 * example:
64 * </p>
65 *
66 * <pre>
67 * /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
68 * </pre>
69 *
70 * @since 2.0-alpha-2
71 */
72 @Parameter(property = "mdep.useRepositoryLayout", defaultValue = "false")
73 protected boolean useRepositoryLayout;
74
75 /**
76 * Place each type of file in a separate subdirectory. (example /outputDirectory/runtime /outputDirectory/provided
77 * etc)
78 *
79 * @since 2.2
80 */
81 @Parameter(property = "mdep.useSubDirectoryPerScope", defaultValue = "false")
82 protected boolean useSubDirectoryPerScope;
83
84 /**
85 * Place each type of file in a separate subdirectory. (example /outputDirectory/jars /outputDirectory/wars etc)
86 *
87 * @since 2.0-alpha-1
88 */
89 @Parameter(property = "mdep.useSubDirectoryPerType", defaultValue = "false")
90 protected boolean useSubDirectoryPerType;
91
92 /**
93 * Place each file in a separate subdirectory. (example <code>/outputDirectory/junit-3.8.1-jar</code>)
94 *
95 * @since 2.0-alpha-1
96 */
97 @Parameter(property = "mdep.useSubDirectoryPerArtifact", defaultValue = "false")
98 protected boolean useSubDirectoryPerArtifact;
99
100 /**
101 * This only applies if the classifier parameter is used.
102 *
103 * @since 2.0-alpha-2
104 */
105 @Parameter(property = "mdep.failOnMissingClassifierArtifact", defaultValue = "false")
106 protected boolean failOnMissingClassifierArtifact = true;
107
108 /**
109 * @return Returns the outputDirectory.
110 */
111 public File getOutputDirectory() {
112 return this.outputDirectory;
113 }
114
115 /**
116 * @param theOutputDirectory The outputDirectory to set.
117 */
118 public void setOutputDirectory(File theOutputDirectory) {
119 this.outputDirectory = theOutputDirectory;
120 }
121
122 /**
123 * @return Returns the useSubDirectoryPerArtifact.
124 */
125 public boolean isUseSubDirectoryPerArtifact() {
126 return this.useSubDirectoryPerArtifact;
127 }
128
129 /**
130 * @param theUseSubDirectoryPerArtifact The useSubDirectoryPerArtifact to set.
131 */
132 public void setUseSubDirectoryPerArtifact(boolean theUseSubDirectoryPerArtifact) {
133 this.useSubDirectoryPerArtifact = theUseSubDirectoryPerArtifact;
134 }
135
136 /**
137 * @return Returns the useSubDirectoryPerScope
138 */
139 public boolean isUseSubDirectoryPerScope() {
140 return this.useSubDirectoryPerScope;
141 }
142
143 /**
144 * @param theUseSubDirectoryPerScope The useSubDirectoryPerScope to set.
145 */
146 public void setUseSubDirectoryPerScope(boolean theUseSubDirectoryPerScope) {
147 this.useSubDirectoryPerScope = theUseSubDirectoryPerScope;
148 }
149
150 /**
151 * @return Returns the useSubDirectoryPerType.
152 */
153 public boolean isUseSubDirectoryPerType() {
154 return this.useSubDirectoryPerType;
155 }
156
157 /**
158 * @param theUseSubDirectoryPerType The useSubDirectoryPerType to set.
159 */
160 public void setUseSubDirectoryPerType(boolean theUseSubDirectoryPerType) {
161 this.useSubDirectoryPerType = theUseSubDirectoryPerType;
162 }
163
164 /**
165 * @return {@link #failOnMissingClassifierArtifact}
166 */
167 public boolean isFailOnMissingClassifierArtifact() {
168 return failOnMissingClassifierArtifact;
169 }
170
171 /**
172 * @param failOnMissingClassifierArtifact {@link #failOnMissingClassifierArtifact}
173 */
174 public void setFailOnMissingClassifierArtifact(boolean failOnMissingClassifierArtifact) {
175 this.failOnMissingClassifierArtifact = failOnMissingClassifierArtifact;
176 }
177
178 /**
179 * @return {@link #stripVersion}
180 */
181 public boolean isStripVersion() {
182 return stripVersion;
183 }
184
185 /**
186 * @param stripVersion {@link #stripVersion}
187 */
188 public void setStripVersion(boolean stripVersion) {
189 this.stripVersion = stripVersion;
190 }
191
192 /**
193 * @return {@link #stripType}
194 */
195 public boolean isStripType() {
196 return stripType;
197 }
198
199 /**
200 * @param stripType {@link #stripType}
201 */
202 public void setStripType(boolean stripType) {
203 this.stripType = stripType;
204 }
205
206 /**
207 * @return true, if dependencies must be planted in a repository layout
208 */
209 public boolean isUseRepositoryLayout() {
210 return useRepositoryLayout;
211 }
212
213 /**
214 * @param useRepositoryLayout - true if dependencies must be planted in a repository layout
215 */
216 public void setUseRepositoryLayout(boolean useRepositoryLayout) {
217 this.useRepositoryLayout = useRepositoryLayout;
218 }
219 }