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