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