1 package org.apache.maven.plugins.dependency.fromDependencies;
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 org.apache.maven.plugins.annotations.Parameter;
23
24 import java.io.File;
25
26 /**
27 * Abstract Parent class used by mojos that get Artifact information from the project dependencies.
28 *
29 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
30 */
31 public abstract class AbstractFromDependenciesMojo
32 extends AbstractDependencyFilterMojo
33 {
34 /**
35 * Output location.
36 *
37 * @since 1.0
38 */
39 @Parameter( property = "outputDirectory", defaultValue = "${project.build.directory}/dependency" )
40 protected File outputDirectory;
41
42 /**
43 * Strip artifact version during copy
44 */
45 @Parameter( property = "mdep.stripVersion", defaultValue = "false" )
46 protected boolean stripVersion = false;
47
48 /**
49 * Strip artifact type during copy
50 *
51 * @since 3.4.0
52 */
53 @Parameter( property = "mdep.stripType", defaultValue = "false" )
54 protected boolean stripType = false;
55
56 /**
57 * Strip artifact classifier during copy
58 */
59 @Parameter( property = "mdep.stripClassifier", defaultValue = "false" )
60 protected boolean stripClassifier = false;
61
62 /**
63 * <p>
64 * Place each artifact in the same directory layout as a default repository.
65 * </p>
66 * <p>
67 * example:
68 * </p>
69 *
70 * <pre>
71 * /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
72 * </pre>
73 *
74 * @since 2.0-alpha-2
75 */
76 @Parameter( property = "mdep.useRepositoryLayout", defaultValue = "false" )
77 protected boolean useRepositoryLayout;
78
79 /**
80 * Place each type of file in a separate subdirectory. (example /outputDirectory/runtime /outputDirectory/provided
81 * etc)
82 *
83 * @since 2.2
84 */
85 @Parameter( property = "mdep.useSubDirectoryPerScope", defaultValue = "false" )
86 protected boolean useSubDirectoryPerScope;
87
88 /**
89 * Place each type of file in a separate subdirectory. (example /outputDirectory/jars /outputDirectory/wars etc)
90 *
91 * @since 2.0-alpha-1
92 */
93 @Parameter( property = "mdep.useSubDirectoryPerType", defaultValue = "false" )
94 protected boolean useSubDirectoryPerType;
95
96 /**
97 * Place each file in a separate subdirectory. (example <code>/outputDirectory/junit-3.8.1-jar</code>)
98 *
99 * @since 2.0-alpha-1
100 */
101 @Parameter( property = "mdep.useSubDirectoryPerArtifact", defaultValue = "false" )
102 protected boolean useSubDirectoryPerArtifact;
103
104 /**
105 * This only applies if the classifier parameter is used.
106 *
107 * @since 2.0-alpha-2
108 */
109 @Parameter( property = "mdep.failOnMissingClassifierArtifact", defaultValue = "false" )
110 protected boolean failOnMissingClassifierArtifact = true;
111
112 /**
113 * @return Returns the outputDirectory.
114 */
115 public File getOutputDirectory()
116 {
117 return this.outputDirectory;
118 }
119
120 /**
121 * @param theOutputDirectory The outputDirectory to set.
122 */
123 public void setOutputDirectory( File theOutputDirectory )
124 {
125 this.outputDirectory = theOutputDirectory;
126 }
127
128 /**
129 * @return Returns the useSubDirectoryPerArtifact.
130 */
131 public boolean isUseSubDirectoryPerArtifact()
132 {
133 return this.useSubDirectoryPerArtifact;
134 }
135
136 /**
137 * @param theUseSubDirectoryPerArtifact The useSubDirectoryPerArtifact to set.
138 */
139 public void setUseSubDirectoryPerArtifact( boolean theUseSubDirectoryPerArtifact )
140 {
141 this.useSubDirectoryPerArtifact = theUseSubDirectoryPerArtifact;
142 }
143
144 /**
145 * @return Returns the useSubDirectoryPerScope
146 */
147 public boolean isUseSubDirectoryPerScope()
148 {
149 return this.useSubDirectoryPerScope;
150 }
151
152 /**
153 * @param theUseSubDirectoryPerScope The useSubDirectoryPerScope to set.
154 */
155 public void setUseSubDirectoryPerScope( boolean theUseSubDirectoryPerScope )
156 {
157 this.useSubDirectoryPerScope = theUseSubDirectoryPerScope;
158 }
159
160 /**
161 * @return Returns the useSubDirectoryPerType.
162 */
163 public boolean isUseSubDirectoryPerType()
164 {
165 return this.useSubDirectoryPerType;
166 }
167
168 /**
169 * @param theUseSubDirectoryPerType The useSubDirectoryPerType to set.
170 */
171 public void setUseSubDirectoryPerType( boolean theUseSubDirectoryPerType )
172 {
173 this.useSubDirectoryPerType = theUseSubDirectoryPerType;
174 }
175
176 /**
177 * @return {@link #failOnMissingClassifierArtifact}
178 */
179 public boolean isFailOnMissingClassifierArtifact()
180 {
181 return failOnMissingClassifierArtifact;
182 }
183
184 /**
185 * @param failOnMissingClassifierArtifact {@link #failOnMissingClassifierArtifact}
186 */
187 public void setFailOnMissingClassifierArtifact( boolean failOnMissingClassifierArtifact )
188 {
189 this.failOnMissingClassifierArtifact = failOnMissingClassifierArtifact;
190 }
191
192 /**
193 * @return {@link #stripVersion}
194 */
195 public boolean isStripVersion()
196 {
197 return stripVersion;
198 }
199
200 /**
201 * @param stripVersion {@link #stripVersion}
202 */
203 public void setStripVersion( boolean stripVersion )
204 {
205 this.stripVersion = stripVersion;
206 }
207
208
209 /**
210 * @return {@link #stripType}
211 */
212 public boolean isStripType()
213 {
214 return stripType;
215 }
216
217 /**
218 * @param stripType {@link #stripType}
219 */
220 public void setStripType( boolean stripType )
221 {
222 this.stripType = stripType;
223 }
224
225
226 /**
227 * @return true, if dependencies must be planted in a repository layout
228 */
229 public boolean isUseRepositoryLayout()
230 {
231 return useRepositoryLayout;
232 }
233
234 /**
235 * @param useRepositoryLayout - true if dependencies must be planted in a repository layout
236 */
237 public void setUseRepositoryLayout( boolean useRepositoryLayout )
238 {
239 this.useRepositoryLayout = useRepositoryLayout;
240 }
241 }