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