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 classifier during copy
50 */
51 @Parameter( property = "mdep.stripClassifier", defaultValue = "false" )
52 protected boolean stripClassifier = false;
53
54 /**
55 * <p>
56 * Place each artifact in the same directory layout as a default repository.
57 * </p>
58 * <p>
59 * example:
60 * </p>
61 *
62 * <pre>
63 * /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
64 * </pre>
65 *
66 * @since 2.0-alpha-2
67 */
68 @Parameter( property = "mdep.useRepositoryLayout", defaultValue = "false" )
69 protected boolean useRepositoryLayout;
70
71 /**
72 * Place each type of file in a separate subdirectory. (example /outputDirectory/runtime /outputDirectory/provided
73 * etc)
74 *
75 * @since 2.2
76 */
77 @Parameter( property = "mdep.useSubDirectoryPerScope", defaultValue = "false" )
78 protected boolean useSubDirectoryPerScope;
79
80 /**
81 * Place each type of file in a separate subdirectory. (example /outputDirectory/jars /outputDirectory/wars etc)
82 *
83 * @since 2.0-alpha-1
84 */
85 @Parameter( property = "mdep.useSubDirectoryPerType", defaultValue = "false" )
86 protected boolean useSubDirectoryPerType;
87
88 /**
89 * Place each file in a separate subdirectory. (example <code>/outputDirectory/junit-3.8.1-jar</code>)
90 *
91 * @since 2.0-alpha-1
92 */
93 @Parameter( property = "mdep.useSubDirectoryPerArtifact", defaultValue = "false" )
94 protected boolean useSubDirectoryPerArtifact;
95
96 /**
97 * This only applies if the classifier parameter is used.
98 *
99 * @since 2.0-alpha-2
100 */
101 @Parameter( property = "mdep.failOnMissingClassifierArtifact", defaultValue = "false" )
102 protected boolean failOnMissingClassifierArtifact = true;
103
104 /**
105 * @return Returns the outputDirectory.
106 */
107 public File getOutputDirectory()
108 {
109 return this.outputDirectory;
110 }
111
112 /**
113 * @param theOutputDirectory The outputDirectory to set.
114 */
115 public void setOutputDirectory( File theOutputDirectory )
116 {
117 this.outputDirectory = theOutputDirectory;
118 }
119
120 /**
121 * @return Returns the useSubDirectoryPerArtifact.
122 */
123 public boolean isUseSubDirectoryPerArtifact()
124 {
125 return this.useSubDirectoryPerArtifact;
126 }
127
128 /**
129 * @param theUseSubDirectoryPerArtifact The useSubDirectoryPerArtifact to set.
130 */
131 public void setUseSubDirectoryPerArtifact( boolean theUseSubDirectoryPerArtifact )
132 {
133 this.useSubDirectoryPerArtifact = theUseSubDirectoryPerArtifact;
134 }
135
136 /**
137 * @return Returns the useSubDirectoryPerScope
138 */
139 public boolean isUseSubDirectoryPerScope()
140 {
141 return this.useSubDirectoryPerScope;
142 }
143
144 /**
145 * @param theUseSubDirectoryPerScope The useSubDirectoryPerScope to set.
146 */
147 public void setUseSubDirectoryPerScope( boolean theUseSubDirectoryPerScope )
148 {
149 this.useSubDirectoryPerScope = theUseSubDirectoryPerScope;
150 }
151
152 /**
153 * @return Returns the useSubDirectoryPerType.
154 */
155 public boolean isUseSubDirectoryPerType()
156 {
157 return this.useSubDirectoryPerType;
158 }
159
160 /**
161 * @param theUseSubDirectoryPerType The useSubDirectoryPerType to set.
162 */
163 public void setUseSubDirectoryPerType( boolean theUseSubDirectoryPerType )
164 {
165 this.useSubDirectoryPerType = theUseSubDirectoryPerType;
166 }
167
168 /**
169 * @return {@link #failOnMissingClassifierArtifact}
170 */
171 public boolean isFailOnMissingClassifierArtifact()
172 {
173 return failOnMissingClassifierArtifact;
174 }
175
176 /**
177 * @param failOnMissingClassifierArtifact {@link #failOnMissingClassifierArtifact}
178 */
179 public void setFailOnMissingClassifierArtifact( boolean failOnMissingClassifierArtifact )
180 {
181 this.failOnMissingClassifierArtifact = failOnMissingClassifierArtifact;
182 }
183
184 /**
185 * @return {@link #stripVersion}
186 */
187 public boolean isStripVersion()
188 {
189 return stripVersion;
190 }
191
192 /**
193 * @param stripVersion {@link #stripVersion}
194 */
195 public void setStripVersion( boolean stripVersion )
196 {
197 this.stripVersion = stripVersion;
198 }
199
200 /**
201 * @return true, if dependencies must be planted in a repository layout
202 */
203 public boolean isUseRepositoryLayout()
204 {
205 return useRepositoryLayout;
206 }
207
208 /**
209 * @param useRepositoryLayout - true if dependencies must be planted in a repository layout
210 */
211 public void setUseRepositoryLayout( boolean useRepositoryLayout )
212 {
213 this.useRepositoryLayout = useRepositoryLayout;
214 }
215 }