1 package org.apache.maven.plugin.dependency;
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 * Abstract Parent class used by mojos that get Artifact information from the
26 * project dependencies.
27 *
28 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
29 * @version $Id: AbstractFromDependenciesMojo.java 728546 2008-12-21 22:56:51Z bentmann $
30 */
31 public abstract class AbstractFromDependenciesMojo
32 extends AbstractDependencyFilterMojo
33 {
34
35 /**
36 * Strip artifact version during copy
37 *
38 * @optional
39 * @parameter expression="${mdep.stripVersion}" default-value="false"
40 * @parameter
41 */
42 protected boolean stripVersion = false;
43
44 /**
45 * Default location used for mojo unless overridden in ArtifactItem
46 *
47 * @parameter expression="${outputDirectory}"
48 * default-value="${project.build.directory}/dependency"
49 * @optional
50 * @since 1.0
51 */
52 protected File outputDirectory;
53
54 /**
55 * Place each artifact in the same directory layout as a default repository.
56 * <br/>example: /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
57 * @since 2.0-alpha-2
58 * @parameter expression="${mdep.useRepositoryLayout}" default-value="false"
59 * @optional
60 */
61 protected boolean useRepositoryLayout;
62
63 /**
64 * Also copy the pom of each artifact.
65 *
66 * @since 2.0
67 * @parameter expression="${mdep.copyPom}"
68 * default-value="false"
69 * @optional
70 */
71 protected boolean copyPom = true;
72
73 /**
74 * Place each type of file in a separate subdirectory. (example
75 * /outputDirectory/jars /outputDirectory/wars etc)
76 *
77 * @since 2.0-alpha-1
78 * @parameter expression="${mdep.useSubDirectoryPerType}" default-value="false"
79 * @optional
80 */
81 protected boolean useSubDirectoryPerType;
82
83 /**
84 * Place each file in a separate subdirectory. (example
85 * /outputDirectory/junit-3.8.1-jar)
86 *
87 * @since 2.0-alpha-1
88 * @parameter expression="${mdep.useSubDirectoryPerArtifact}"
89 * default-value="false"
90 * @optional
91 */
92 protected boolean useSubDirectoryPerArtifact;
93
94 /**
95 * This only applies if the classifier parameter is used.
96 *
97 * @since 2.0-alpha-2
98 * @parameter expression="${mdep.failOnMissingClassifierArtifact}"
99 * default-value="true"
100 * @optional
101 */
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
114 * 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
131 * The useSubDirectoryPerArtifact to set.
132 */
133 public void setUseSubDirectoryPerArtifact( boolean theUseSubDirectoryPerArtifact )
134 {
135 this.useSubDirectoryPerArtifact = theUseSubDirectoryPerArtifact;
136 }
137
138 /**
139 * @return Returns the useSubDirectoryPerType.
140 */
141 public boolean isUseSubDirectoryPerType()
142 {
143 return this.useSubDirectoryPerType;
144 }
145
146 /**
147 * @param theUseSubDirectoryPerType
148 * The useSubDirectoryPerType to set.
149 */
150 public void setUseSubDirectoryPerType( boolean theUseSubDirectoryPerType )
151 {
152 this.useSubDirectoryPerType = theUseSubDirectoryPerType;
153 }
154
155 public boolean isFailOnMissingClassifierArtifact()
156 {
157 return failOnMissingClassifierArtifact;
158 }
159
160 public void setFailOnMissingClassifierArtifact( boolean failOnMissingClassifierArtifact )
161 {
162 this.failOnMissingClassifierArtifact = failOnMissingClassifierArtifact;
163 }
164
165 public boolean isStripVersion()
166 {
167 return stripVersion;
168 }
169
170 public void setStripVersion( boolean stripVersion )
171 {
172 this.stripVersion = stripVersion;
173 }
174
175 /**
176 *
177 * @return true, if dependencies must be planted in a repository layout
178 */
179 public boolean isUseRepositoryLayout()
180 {
181 return useRepositoryLayout;
182 }
183
184 /**
185 *
186 * @param useRepositoryLayout -
187 * true if dependencies must be planted in a repository layout
188 */
189 public void setUseRepositoryLayout( boolean useRepositoryLayout )
190 {
191 this.useRepositoryLayout = useRepositoryLayout;
192 }
193
194 /**
195 * @return true, if the pom of each artifact must be copied
196 */
197 public boolean isCopyPom() {
198 return this.copyPom;
199 }
200
201 /**
202 * @param copyPom - true if the pom of each artifact must be copied
203 */
204 public void setCopyPom(boolean copyPom) {
205 this.copyPom = copyPom;
206 }
207 }