View Javadoc

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 1085777 2011-03-26 18:13:19Z hboutemy $
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/runtime /outputDirectory/provided etc)
76       *
77       * @parameter expression="${mdep.useSubDirectoryPerScope}" default-value="false"
78       * @optional
79       * @since 2.2
80       */
81      protected boolean useSubDirectoryPerScope;
82  
83      /**
84       * Place each type of file in a separate subdirectory. (example
85       * /outputDirectory/jars /outputDirectory/wars etc)
86       *
87       * @since 2.0-alpha-1
88       * @parameter expression="${mdep.useSubDirectoryPerType}" default-value="false"
89       * @optional
90       */
91      protected boolean useSubDirectoryPerType;
92  
93      /**
94       * Place each file in a separate subdirectory. (example
95       * <code>/outputDirectory/junit-3.8.1-jar</code>)
96       *
97       * @since 2.0-alpha-1
98       * @parameter expression="${mdep.useSubDirectoryPerArtifact}"
99       *            default-value="false"
100      * @optional
101      */
102     protected boolean useSubDirectoryPerArtifact;
103 
104     /**
105      * This only applies if the classifier parameter is used.
106      *
107      * @since 2.0-alpha-2
108      * @parameter expression="${mdep.failOnMissingClassifierArtifact}"
109      *            default-value="true"
110      * @optional
111      */
112     protected boolean failOnMissingClassifierArtifact = true;
113 
114     /**
115      * @return Returns the outputDirectory.
116      */
117     public File getOutputDirectory()
118     {
119         return this.outputDirectory;
120     }
121 
122     /**
123      * @param theOutputDirectory
124      *            The outputDirectory to set.
125      */
126     public void setOutputDirectory( File theOutputDirectory )
127     {
128         this.outputDirectory = theOutputDirectory;
129     }
130 
131     /**
132      * @return Returns the useSubDirectoryPerArtifact.
133      */
134     public boolean isUseSubDirectoryPerArtifact()
135     {
136         return this.useSubDirectoryPerArtifact;
137     }
138 
139     /**
140      * @param theUseSubDirectoryPerArtifact
141      *            The useSubDirectoryPerArtifact to set.
142      */
143     public void setUseSubDirectoryPerArtifact( boolean theUseSubDirectoryPerArtifact )
144     {
145         this.useSubDirectoryPerArtifact = theUseSubDirectoryPerArtifact;
146     }
147 
148     /**
149      * @return Returns the useSubDirectoryPerScope
150      */
151     public boolean isUseSubDirectoryPerScope()
152     {
153         return this.useSubDirectoryPerScope;
154     }
155     
156     /**
157      * @param theUseSubDirectoryPerScope
158      *          The useSubDirectoryPerScope to set.
159      */
160     public void setUseSubDirectoryPerScope( boolean theUseSubDirectoryPerScope )
161     {
162         this.useSubDirectoryPerScope = theUseSubDirectoryPerScope;
163     }
164 
165     /**
166      * @return Returns the useSubDirectoryPerType.
167      */
168     public boolean isUseSubDirectoryPerType()
169     {
170         return this.useSubDirectoryPerType;
171     }
172 
173     /**
174      * @param theUseSubDirectoryPerType
175      *            The useSubDirectoryPerType to set.
176      */
177     public void setUseSubDirectoryPerType( boolean theUseSubDirectoryPerType )
178     {
179         this.useSubDirectoryPerType = theUseSubDirectoryPerType;
180     }
181 
182     public boolean isFailOnMissingClassifierArtifact()
183     {
184         return failOnMissingClassifierArtifact;
185     }
186 
187     public void setFailOnMissingClassifierArtifact( boolean failOnMissingClassifierArtifact )
188     {
189         this.failOnMissingClassifierArtifact = failOnMissingClassifierArtifact;
190     }
191 
192     public boolean isStripVersion()
193     {
194         return stripVersion;
195     }
196 
197     public void setStripVersion( boolean stripVersion )
198     {
199         this.stripVersion = stripVersion;
200     }
201 
202     /**
203      *
204      * @return true, if dependencies must be planted in a repository layout
205      */
206     public boolean isUseRepositoryLayout()
207     {
208         return useRepositoryLayout;
209     }
210 
211     /**
212      *
213      * @param useRepositoryLayout -
214      *            true if dependencies must be planted in a repository layout
215      */
216     public void setUseRepositoryLayout( boolean useRepositoryLayout )
217     {
218         this.useRepositoryLayout = useRepositoryLayout;
219     }
220 
221     /**
222      * @return true, if the pom of each artifact must be copied
223      */
224     public boolean isCopyPom()
225     {
226         return this.copyPom;
227     }
228 
229     /**
230      * @param copyPom - true if the pom of each artifact must be copied
231      */
232     public void setCopyPom( boolean copyPom )
233     {
234         this.copyPom = copyPom;
235     }
236 
237 }