├── .gitignore
├── .travis.yml
├── COPYING
├── README.md
├── pom.xml
└── src
├── build
├── findbugsExcludeFilter.xml
└── license-header.txt
├── it
├── README.md
├── settings.xml
├── setup-class-jars
│ ├── first-class-jar
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── diff
│ │ │ └── Demo.java
│ ├── first-diff-jar
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── diff
│ │ │ └── Demo.java
│ ├── invoker.properties
│ ├── pom.xml
│ └── second-class-jar
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ └── java
│ │ └── demo
│ │ └── Demo.java
├── setup-resource-jars
│ ├── first-jar
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── resources
│ │ │ ├── conflict-different-content
│ │ │ └── conflict-same-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── second-jar
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ └── resources
│ │ ├── conflict-different-content
│ │ └── conflict-same-content
├── test-class-conflict-default-print-equal
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-class-conflict-default
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-class-conflict-diff-fail-diff-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-class-conflict-diff-fail-equal-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-class-conflict-diff-fail
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-class-conflict-equal-fail-diff-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-class-conflict-equal-fail-equal-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-class-conflict-equal-fail
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-class-conflict-fail
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-resource-conflict-default-print-equal
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-resource-conflict-default
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-resource-conflict-diff-fail-diff-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-resource-conflict-diff-fail-equal-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-resource-conflict-diff-fail
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-resource-conflict-equal-fail-diff-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-resource-conflict-equal-fail-equal-content
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
├── test-resource-conflict-equal-fail
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
└── test-resource-conflict-fail
│ ├── invoker.properties
│ ├── pom.xml
│ └── verify.groovy
└── main
└── java
└── com
└── ning
└── maven
└── plugins
└── duplicatefinder
├── ClasspathDescriptor.java
├── DependencyWrapper.java
├── DuplicateFinderMojo.java
├── Exception.java
└── ToStringComparator.java
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.iml
3 | *.ipr
4 | *.iws
5 | .classpath
6 | .project
7 | .settings
8 | target
9 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - openjdk6
4 | - oraclejdk7
5 | - oraclejdk8
6 | install: mvn -DskipTests=true -Dbasepom.check.skip-all=true -Dbasepom.it.skip=true -B install
7 | script: mvn -B verify
8 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [2010] [Ning, Inc.]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Maven duplicate finder plugin
2 |
3 | ** PLUGIN HAS MOVED **
4 |
5 | Starting with version 1.1.0, [the duplicate finder plugin has moved](https://github.com/basepom/duplicate-finder-maven-plugin).
6 |
7 | Please contribute any pull requests, but reports etc. to the the new location.
8 |
9 | ** PLUGIN HAS MOVED **
10 |
11 | ## Major changes from Version 1.0.x
12 |
13 | Starting with version 1.1.0 of the duplicate finder plugin, Maven 3.x and Java 6 or better are **required**.
14 |
15 | Also, the plugin artifact id has been changed to *duplicate-finder-maven-plugin* as is required with Maven 3.x (and probably enforced at some point).
16 |
17 | If upgrading to version 1.1.0 or newer is not possible, use
18 |
19 | ```xml
20 |
21 | com.ning.maven.plugins
22 | maven-duplicate-finder-plugin
23 | 1.0.8
24 |
25 | ```
26 |
27 | ## What is it
28 |
29 | The `duplicate-finder-maven-plugin` is a plugin that will search for classes with the same name, as well as resources with the same path,
30 | in the classpaths of a maven project. More specifically, it will check the compile, runtime, and test classpaths for
31 |
32 | * Classes with the same qualified name in the current project and all dependencies relevant for that classpath
33 | * Files that are not `class` files, with the same resource path (i.e. as if it would be accessed via the classloader) in the current project and all dependencies relevant for that classpath
34 | (Note that at the moment, the plugin does not check if the files are actually the same or not, it only looks for the same file/class name.)
35 |
36 | ## How to use it
37 |
38 | ### Configuration
39 |
40 | To make commandline usage a bit easier, you should add the
41 | `com.ning.maven.plugins` group to the `pluginGroups` section in your settings file:
42 |
43 |
44 | ...
45 |
46 | com.ning.maven.plugins
47 |
48 | ...
49 |
50 |
51 | ### Running it
52 |
53 | Usually, the plugin does not need to be configured in the POM. You can simply execute it via maven command line in a directory that contains a POM
54 | (which can be a multi-module POM):
55 |
56 | ```bash
57 | mvn duplicate-finder:check
58 | ```
59 |
60 | This will check for the latest version of the plugin, download it if necessary, and then execute it. Note that you might get snapshot versions this way.
61 | You can also run a specific version using the fully qualified plugin identifier:
62 |
63 | ```bash
64 | mvn com.ning.maven.plugins:duplicate-finder-maven-plugin:1.1.0:check
65 | ```
66 |
67 | If you want to include it in the normal build, configure it like this:
68 |
69 | ```xml
70 |
71 | com.ning.maven.plugins
72 | duplicate-finder-maven-plugin
73 |
74 |
75 | verify
76 |
77 | check
78 |
79 |
80 |
81 |
82 | ```
83 |
84 | A successful run will look like this:
85 |
86 | ```
87 | [INFO] [duplicate-finder:check {execution: default-cli}]
88 | [INFO] Checking compile classpath
89 | [INFO] Checking runtime classpath
90 | [INFO] Checking test classpath
91 | ```
92 |
93 | If you run the plugin on its own source code, you'll instead get something like
94 |
95 | ```
96 | [WARNING] Found duplicate and different classes in [commons-logging:commons-logging:1.1.1,commons-logging:commons-logging-api:1.1] :
97 | [WARNING] org.apache.commons.logging.Log
98 | [WARNING] org.apache.commons.logging.LogConfigurationException
99 | [WARNING] org.apache.commons.logging.LogFactory
100 | [WARNING] org.apache.commons.logging.LogSource
101 | [WARNING] org.apache.commons.logging.impl.Jdk14Logger
102 | [WARNING] org.apache.commons.logging.impl.LogFactoryImpl
103 | [WARNING] org.apache.commons.logging.impl.NoOpLog
104 | [WARNING] org.apache.commons.logging.impl.SimpleLog
105 | [WARNING] org.apache.commons.logging.impl.WeakHashtable
106 | [WARNING] Found duplicate and different resources in [org.springframework:spring-aop:3.0.3.RELEASE,org.springframework:spring-beans:3.0.3.RELEASE,org.springframework:spring-context:3.0.3.RELEASE,org.springframework:spring-core:3.0.3.RELEASE] :
107 | [WARNING] overview.html
108 | [WARNING] Found duplicate and different resources in [org.springframework:spring-aop:3.0.3.RELEASE,org.springframework:spring-beans:3.0.3.RELEASE,org.springframework:spring-context:3.0.3.RELEASE] :
109 | [WARNING] META-INF/spring.tooling
110 | ```
111 |
112 | The above example shows a duplicate resource and a duplicate class in the current POM. In either case, it will print the qualified names of all artifacts that
113 | have these classes/resources - this includes the current project. To make the output a bit easier to read, all duplicate classes are grouped by the set of
114 | artifacts that have it. E.g. in the example, the `org.apache.commons.logging.*` classes are all found in two particular artifacts, so they are all
115 | combined in one group.
116 |
117 | The plugin can also be configured to fail the build (see below), in which case it will print an additional
118 |
119 | ```
120 | [ERROR] Found duplicate classes/resources
121 | ```
122 |
123 | ### Configuring it
124 |
125 | In some cases you need to configure the plugin to make exceptions, i.e. allow duplicate classes or resources for specific artifacts. For instance, multiple
126 | dependencies might contain base XML classes in the `javax.xml` and `org.w3c` packages. If you are sure that these are the same and thus the
127 | duplication can be ignored, you can define exceptions like this:
128 |
129 | ```xml
130 |
131 | com.ning.maven.plugins
132 | duplicate-finder-maven-plugin
133 | 1.1.0
134 |
135 |
136 |
137 |
138 |
139 | jaxen
140 | jaxen
141 | 1.1.1
142 |
143 |
144 | xml-apis
145 | xml-apis
146 | [1.3.02,1.3.03]
147 |
148 |
149 |
150 | org.w3c.dom.UserDataHandler
151 |
152 |
153 |
154 |
155 |
156 | xerces
157 | xercesImpl
158 | 2.6.2
159 |
160 |
161 | xml-apis
162 | xml-apis
163 | [1.3.02,1.3.03]
164 |
165 |
166 |
167 | org.w3c.dom.ls
168 |
169 |
170 |
171 |
172 |
173 | xerces
174 | xmlParserAPIs
175 | 2.6.2
176 |
177 |
178 | xml-apis
179 | xml-apis
180 | [1.3.02,1.3.03]
181 |
182 |
183 | xmlrpc
184 | xmlrpc
185 | 2.0
186 |
187 |
188 |
189 | org.apache.xmlcommons.Version
190 |
191 |
192 | javax.xml.parsers
193 | javax.xml.transform
194 | org.w3c.dom
195 | org.xml.sax
196 |
197 |
198 |
199 |
200 |
201 | stax
202 | stax-api
203 | 1.0.1
204 |
205 |
206 | xml-apis
207 | xml-apis
208 | [1.3.02,1.3.03]
209 |
210 |
211 |
212 | javax.xml.XMLConstants
213 | javax.xml.namespace.NamespaceContext
214 | javax.xml.namespace.QName
215 |
216 |
217 |
218 |
219 |
220 | xalan
221 | xalan
222 | 2.6.0
223 |
224 |
225 | xml-apis
226 | xml-apis
227 | [1.3.02,1.3.03]
228 |
229 |
230 |
231 | org.w3c.dom.xpath
232 |
233 |
234 |
235 |
236 |
237 |
238 | verify
239 |
240 | check
241 |
242 |
243 |
244 |
245 | ```
246 |
247 | ### Ignoring dependencies
248 |
249 | In some rare cases, you want to completely remove a dependency from the check. For instance, in the above example, it might be better to completely ignore
250 | the `xml-apis:xml-apis` dependencies:
251 |
252 | ```xml
253 |
254 | com.ning.maven.plugins
255 | duplicate-finder-maven-plugin
256 | 1.1.0
257 |
258 |
259 |
260 | xml-apis
261 | xml-apis
262 | 1.3.02
263 |
264 |
265 | xml-apis
266 | xml-apis
267 | 1.3.03
268 |
269 |
270 | ...
271 |
272 |
273 | ```
274 |
275 | *Please use this only if absolutely necessary!*
276 |
277 | ### Allowing classes
278 |
279 | ```xml
280 |
281 |
282 |
283 | xerces
284 | xmlParserAPIs
285 | 2.6.2
286 |
287 |
288 | xml-apis
289 | xml-apis
290 | [1.3.02,1.3.03]
291 |
292 |
293 | xmlrpc
294 | xmlrpc
295 | 2.0
296 |
297 |
298 |
299 | org.apache.xmlcommons.Version
300 |
301 |
302 | javax.xml.parsers
303 | javax.xml.transform
304 | org.w3c.dom
305 | org.xml.sax
306 |
307 |
308 | ```
309 |
310 | The `conflictingDependencies` section states the artifacts for which duplicate class conflicts are allowed. Note that in a particular project, not all of
311 | these artifacts have to participate. E.g. for the above example, a duplicate class for class `org.apache.xmlcommons.Version` between artifacts
312 | `xerces:xmlParserAPIs:2.6.2` and `xml-apis:xml-apis:1.3.03` would be matched even if `xmlrpc:xmlrpc` is not involved.
313 |
314 | The `version` identifier uses the normal [Maven version specification](http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution).
315 |
316 | *Please use version ranges only if you are sure that all of these versions are fine.*
317 |
318 | You can specify the classes via direct `class` elements (e.g. for `org.apache.xmlcommons.Version` in the above section), or via
319 | `packages` elements. Note that a `org.xml.sax` element will match the `org.xml.sax` package *plus* all sub packages.
320 |
321 | *You want to be as exact as possible. Use packages only if necessary, and use the most specific package.*
322 |
323 | ### Allowing resources
324 |
325 | Adding exceptions for resources works the same way:
326 |
327 | ```xml
328 |
329 |
330 | ...
331 |
332 |
333 | log4j.xml
334 |
335 |
336 | files.*
337 |
338 |
339 | ```
340 |
341 | Note that there is no corresponding concept to packages for resources, you'll have to specify each resource individually.
342 |
343 | The Resource pattern allows excluding multiple files or pathes by applying regular expressions to the resources in question.
344 |
345 | The plugin by default ignores several resources that are frequently found in dependencies. They follow these regular expressions (case-insensitive):
346 |
347 | ```
348 | (META-INF/)?ASL2\.0(\.TXT)?
349 | META-INF/DEPENDENCIES(\.TXT)?
350 | META-INF/DISCLAIMER(\.TXT)?
351 | (META-INF/)?[A-Z_-]*LICENSE.*
352 | META-INF/MANIFEST\.MF
353 | META-INF/INDEX\.LIST
354 | META-INF/MAVEN/.*
355 | META-INF/SERVICES/.*,
356 | (META-INF/)?NOTICE(\.TXT)?
357 | README(\.TXT)?
358 | .*PACKAGE\.HTML
359 | .*OVERVIEW\.HTML
360 | META-INF/SPRING\.HANDLERS
361 | META-INF/SPRING\.SCHEMAS
362 | META-INF/SPRING\.TOOLING
363 | .GIT
364 | .SVN
365 | .HG
366 | .BZR
367 | ```
368 |
369 | You can turn these default resource exceptions off via the `useDefaultResourceIgnoreList` configuration option:
370 |
371 | ```xml
372 |
373 | com.ning.maven.plugins
374 | duplicate-finder-maven-plugin
375 | 1.1.0
376 |
377 | false
378 | ...
379 |
380 |
381 | ```
382 |
383 | ### Globally ignoring additional resources
384 |
385 | It is possible to specify additional resources on the classpath that are excluded from the duplication check:
386 |
387 | ```xml
388 |
389 | overview\.html
390 |
391 | ```
392 |
393 | will ignore all occurences of `overview.html` on the classpath. This is useful for resources that are present in many dependencies.
394 |
395 | The resource definition is a pattern as consumed by `java.util.regex.Pattern`.
396 |
397 | ### Failing the build
398 |
399 | By default, the plugin will only print warning. However, you can configure it to fail the build using the `failBuildInCaseOfConflict` configuration option:
400 |
401 | ```xml
402 |
403 | com.ning.maven.plugins
404 | duplicate-finder-maven-plugin
405 |
406 | true
407 | ...
408 |
409 |
410 | ```
411 |
412 | This will fail the build even in case of duplicate but identical classes/resources (as per their SHA256).
413 | If you don't want that, then use these two for more fine-grained control:
414 |
415 | ```xml
416 | true
417 | false
418 | ```
419 |
420 | ### Verbose output
421 |
422 | By default the plugin will not print duplicate but identical classes/resources (as per SHA256).
423 | If you want to see those classes/resources, add this configuration option:
424 |
425 | ```xml
426 | true
427 | ```
428 |
429 | Note that this flag is ignored if either `failBuildInCaseOfConflict` or
430 | `failBuildInCaseOfEqualContentConflict` are set to `true`.
431 |
432 | ## License
433 |
434 | (C) 2010 Ning, Inc.
435 |
436 | Licensed under the Apache Software License, Version 2.0. For details see the COPYING file.
437 |
438 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 | 4.0.0
18 |
19 |
20 | org.basepom
21 | basepom-standard-oss
22 | 7
23 |
24 |
25 | com.ning.maven.plugins
26 | duplicate-finder-maven-plugin
27 | maven-plugin
28 |
29 | 1.1.0-SNAPSHOT
30 | duplicate-finder-maven-plugin Maven Mojo
31 |
32 |
33 | The Maven duplicate-finder plugin provides goals to check the various maven scoped classpaths (compile, runtime, test) for duplicate classes and resources.
34 |
35 |
36 | https://github.com/ning/maven-duplicate-finder-plugin
37 |
38 |
39 |
40 | Apache License 2.0
41 | http://www.apache.org/licenses/LICENSE-2.0.html
42 | repo
43 |
44 |
45 |
46 |
47 | scm:git:git://github.com/ning/maven-duplicate-finder-plugin.git
48 | scm:git:git://github.com/ning/maven-duplicate-finder-plugin.git
49 | https://github.com/ning/maven-duplicate-finder-plugin
50 |
51 |
52 |
53 | Github
54 | https://github.com/ning/maven-duplicate-finder-plugin/issues
55 |
56 |
57 |
58 |
59 | tomdz
60 | Thomas Dudziak
61 | http://tomdz.org
62 | -8
63 |
64 |
65 | hgschmie
66 | Henning Schmiedehausen
67 | -8
68 |
69 |
70 |
71 |
72 |
73 | Conny Kreyssel
74 |
75 |
76 |
77 |
78 | ${env.JAVA6_HOME}
79 |
80 | 1.6
81 | false
82 | 3.0
83 | 1.5.5
84 | 3.2
85 |
86 |
87 |
88 |
89 | org.apache.maven
90 | maven-plugin-api
91 | ${dep.maven-api.version}
92 |
93 |
94 | org.sonatype.sisu
95 | sisu-inject-plexus
96 |
97 |
98 |
99 |
100 |
101 | org.apache.maven.plugin-tools
102 | maven-plugin-annotations
103 | ${dep.plugin.plugin.version}
104 | provided
105 |
106 |
107 |
108 | org.apache.maven
109 | maven-model
110 | ${dep.maven-api.version}
111 |
112 |
113 |
114 | org.apache.maven
115 | maven-artifact
116 | ${dep.maven-api.version}
117 |
118 |
119 |
120 | org.apache.maven
121 | maven-core
122 | ${dep.maven-api.version}
123 |
124 |
125 | org.apache.maven.reporting
126 | maven-reporting-api
127 |
128 |
129 | org.apache.maven.wagon
130 | wagon-file
131 |
132 |
133 | org.apache.maven.wagon
134 | wagon-http-lightweight
135 |
136 |
137 | org.apache.maven.wagon
138 | wagon-ssh
139 |
140 |
141 | org.apache.maven.wagon
142 | wagon-ssh-external
143 |
144 |
145 | commons-cli
146 | commons-cli
147 |
148 |
149 | classworlds
150 | classworlds
151 |
152 |
153 | org.codehaus.plexus
154 | plexus-interactivity-api
155 |
156 |
157 | org.sonatype.sisu
158 | sisu-inject-plexus
159 |
160 |
161 |
162 |
163 |
164 | com.google.guava
165 | guava
166 |
167 |
168 |
169 | commons-lang
170 | commons-lang
171 |
172 |
173 |
174 | commons-io
175 | commons-io
176 |
177 |
178 |
179 | commons-codec
180 | commons-codec
181 |
182 |
183 |
184 | com.google.code.findbugs
185 | annotations
186 |
187 |
188 |
189 | org.slf4j
190 | slf4j-log4j12
191 | runtime
192 |
193 |
194 |
195 | org.slf4j
196 | slf4j-api
197 |
198 |
199 |
200 | com.pyx4j
201 | maven-plugin-log4j
202 | 1.0.1
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 | org.codehaus.plexus
211 | plexus-component-metadata
212 | ${dep.plexus.version}
213 |
214 |
215 |
216 | org.apache.maven.plugins
217 | maven-plugin-plugin
218 | ${dep.plugin.plugin.version}
219 |
220 | true
221 |
222 |
223 |
224 |
225 | com.mycila
226 | license-maven-plugin
227 |
228 | src/build/license-header.txt
229 |
230 | SLASHSTAR_STYLE
231 |
232 |
233 | **/conflict-different-content
234 | **/conflict-same-content
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 | org.apache.maven.plugins
244 | maven-plugin-plugin
245 |
246 |
247 | mojo-descriptor
248 | process-classes
249 |
250 | descriptor
251 |
252 |
253 |
254 | help-goal
255 |
256 | helpmojo
257 |
258 |
259 |
260 |
261 |
262 |
263 | org.codehaus.plexus
264 | plexus-component-metadata
265 |
266 |
267 |
268 | generate-metadata
269 |
270 |
271 |
272 |
273 |
274 |
275 | org.codehaus.mojo
276 | findbugs-maven-plugin
277 |
278 | ${project.basedir}/src/build/findbugsExcludeFilter.xml
279 |
280 |
281 |
282 |
283 | org.apache.maven.plugins
284 | maven-pmd-plugin
285 |
286 |
287 | target/generated-sources/plugin
288 |
289 |
290 |
291 |
292 |
293 | org.apache.maven.plugins
294 | maven-invoker-plugin
295 |
296 |
297 |
298 |
299 | com.google.guava
300 | guava
301 | ${dep.guava.version}
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 | travis
311 |
312 |
313 | env.TRAVIS
314 |
315 |
316 |
317 | ${env.JAVA_HOME}
318 |
319 |
320 |
321 | findbugs-jdk6
322 |
323 | [,1.7)
324 |
325 |
326 | 2.0.3
327 | 2.5.4
328 |
329 |
330 |
331 | cross-compile
332 |
333 | (1.6,]
334 |
335 |
336 |
337 |
338 |
339 | maven-compiler-plugin
340 |
341 |
342 | ${project.jdk6.home}/jre/lib/rt.jar:${project.jdk6.home}/jre/lib/jce.jar:${project.jdk6.home}/../classes/classes.jar
343 |
344 |
345 |
346 |
347 | maven-javadoc-plugin
348 |
349 | ${project.jdk6.home}/jre/lib/rt.jar:${project.jdk6.home}/jre/lib/jce.jar:${project.jdk6.home}/../classes/classes.jar
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
--------------------------------------------------------------------------------
/src/build/findbugsExcludeFilter.xml:
--------------------------------------------------------------------------------
1 |
16 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/build/license-header.txt:
--------------------------------------------------------------------------------
1 | Copyright 2010 Ning, Inc.
2 |
3 | Ning licenses this file to you under the Apache License, version 2.0
4 | (the "License"); you may not use this file except in compliance with the
5 | License. You may obtain a copy of the License at:
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 | License for the specific language governing permissions and limitations
13 | under the License.
14 |
--------------------------------------------------------------------------------
/src/it/README.md:
--------------------------------------------------------------------------------
1 | ### Integration tests
2 |
3 | test types:
4 |
5 | * equal: conflict with equal content
6 | * diff: conflict with diffing content
7 | * both: both conflicts
8 |
9 | || Test || description || type || pEF || fBICOF || fBICODCC || fBICOECC || report || success ||
10 | | conflict-default | defaults | both | | | | | diff | yes |
11 | | conflict-default-print-equal | defaults, reporting | both | yes | | | | both | yes |
12 | | conflict-fail | fail flag | both | yes | yes | | | both | no |
13 | | conflict-equal-fail | fail flag | equal | yes | yes | | | equal | no |
14 | | conflict-diff-fail | fail flag | diff | yes | yes | | | diff | no |
15 | | conflict-equal-fail-equal-content | fail equal, equal content | equal | yes | | | yes | equal | no |
16 | | conflict-equal-fail-diff-content | fail equal, diff content | diff | yes | | | yes | diff | no |
17 | | conflict-diff-fail-equal-content | fail diff, equal content | equal | yes | | yes | | equal | yes |
18 | | conflict-diff-fail-diff-content | fail diff, diff content | diff | yes | | yes | | diff | no |
19 |
--------------------------------------------------------------------------------
/src/it/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
30 |
31 |
32 |
33 |
34 | it-repo
35 |
36 | true
37 |
38 |
39 |
40 | local.central
41 | @localRepositoryUrl@
42 |
43 | true
44 |
45 |
46 | true
47 |
48 |
49 |
50 |
51 |
52 | local.central
53 | @localRepositoryUrl@
54 |
55 | true
56 |
57 |
58 | true
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/it/setup-class-jars/first-class-jar/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 | 4.0.0
19 |
20 | com.ning.maven.plugins.duplicate-finder-maven-plugin
21 | first-class-jar
22 | 1.0
23 |
24 |
25 | UTF-8
26 |
27 |
28 |
29 | package
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/it/setup-class-jars/first-class-jar/src/main/java/diff/Demo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package diff;
17 |
18 | public class Demo
19 | {
20 | public static final void main(String ... args) throws Exception {
21 | System.out.println("Hello, first-class-jar World!");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/it/setup-class-jars/first-diff-jar/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 | 4.0.0
19 |
20 | com.ning.maven.plugins.duplicate-finder-maven-plugin
21 | first-diff-jar
22 | 1.0
23 |
24 |
25 | UTF-8
26 |
27 |
28 |
29 | package
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/it/setup-class-jars/first-diff-jar/src/main/java/diff/Demo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package diff;
17 |
18 | public class Demo
19 | {
20 | public static final void main(String ... args) throws Exception {
21 | System.out.println("Hello, first-diff-jar World!");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/it/setup-class-jars/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean install
18 |
--------------------------------------------------------------------------------
/src/it/setup-class-jars/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | setup-class-jars
23 | 1.0
24 | pom
25 |
26 | Creates and installs two jars with nearly identical content into the integration
27 | test maven repository.
28 |
29 | All the integration tests that check reporting or failure of errors use these jars for comparing.
30 |
31 |
32 |
33 | first-class-jar
34 | first-diff-jar
35 | second-class-jar
36 |
37 |
38 |
39 | install
40 |
41 |
42 | org.apache.maven.plugins
43 | maven-install-plugin
44 |
45 |
46 | foundation
47 | install
48 |
49 | install-file
50 |
51 |
52 |
53 | com.ning.maven.plugins.duplicate-finder-maven-plugin
54 | second-equal-jar
55 | 1.0
56 | true
57 | true
58 | jar
59 | 1.0
60 | second-class-jar/target/second-class-jar-1.0.jar
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/src/it/setup-class-jars/second-class-jar/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 | 4.0.0
19 |
20 | com.ning.maven.plugins.duplicate-finder-maven-plugin
21 | second-class-jar
22 | 1.0
23 |
24 |
25 | UTF-8
26 |
27 |
28 |
29 | package
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/it/setup-class-jars/second-class-jar/src/main/java/demo/Demo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package demo;
17 |
18 | public class Demo
19 | {
20 | public static final void main(String ... args) throws Exception {
21 | System.out.println("Hello, second-class-jar World!");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/it/setup-resource-jars/first-jar/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 | 4.0.0
19 |
20 | com.ning.maven.plugins.duplicate-finder-maven-plugin
21 | first-jar
22 | 1.0
23 |
24 |
25 | UTF-8
26 |
27 |
28 |
29 | package
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/it/setup-resource-jars/first-jar/src/main/resources/conflict-different-content:
--------------------------------------------------------------------------------
1 | 3575f42a-3c8c-11e4-9be3-bcaec5228081
2 |
--------------------------------------------------------------------------------
/src/it/setup-resource-jars/first-jar/src/main/resources/conflict-same-content:
--------------------------------------------------------------------------------
1 | 37c72118-3c8c-11e4-bdd3-bcaec5228081
2 |
--------------------------------------------------------------------------------
/src/it/setup-resource-jars/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean install
18 |
--------------------------------------------------------------------------------
/src/it/setup-resource-jars/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | setup-resource-jars
23 | 1.0
24 | pom
25 |
26 |
27 | first-jar
28 | second-jar
29 |
30 |
31 |
32 | install
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/it/setup-resource-jars/second-jar/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 | 4.0.0
19 |
20 | com.ning.maven.plugins.duplicate-finder-maven-plugin
21 | second-jar
22 | 1.0
23 |
24 |
25 | UTF-8
26 |
27 |
28 |
29 | package
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/it/setup-resource-jars/second-jar/src/main/resources/conflict-different-content:
--------------------------------------------------------------------------------
1 | 494e8354-3c8c-11e4-ad33-bcaec5228081
2 |
--------------------------------------------------------------------------------
/src/it/setup-resource-jars/second-jar/src/main/resources/conflict-same-content:
--------------------------------------------------------------------------------
1 | 37c72118-3c8c-11e4-bdd3-bcaec5228081
2 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-default-print-equal/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = success
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-default-print-equal/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-default-print-equal
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | first-diff-jar
43 | 1.0
44 |
45 |
46 | com.ning.maven.plugins.duplicate-finder-maven-plugin
47 | second-equal-jar
48 | 1.0
49 |
50 |
51 |
52 |
53 | verify
54 |
55 |
56 |
57 | com.ning.maven.plugins
58 | duplicate-finder-maven-plugin
59 | @project.version@
60 |
61 | true
62 |
71 | false
72 | false
73 | true
74 |
75 |
76 |
77 | verify
78 |
79 | check
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-default-print-equal/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:first-diff-jar:1.0]",
27 | "[WARNING] Found duplicate (but equal) classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:second-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-equal-jar:1.0]"
28 | ]
29 |
30 | def excludeMessages = [
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-default/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = success
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-default/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-default
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | first-diff-jar
43 | 1.0
44 |
45 |
46 | com.ning.maven.plugins.duplicate-finder-maven-plugin
47 | second-equal-jar
48 | 1.0
49 |
50 |
51 |
52 |
53 | verify
54 |
55 |
56 |
57 | com.ning.maven.plugins
58 | duplicate-finder-maven-plugin
59 | @project.version@
60 |
61 |
71 | false
72 | false
73 | true
74 |
75 |
76 |
77 | verify
78 |
79 | check
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-default/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:first-diff-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate (but equal) classes"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail-diff-content/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail-diff-content/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-diff-fail-diff-content
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | first-diff-jar
43 | 1.0
44 |
45 |
46 |
47 |
48 | verify
49 |
50 |
51 |
52 | com.ning.maven.plugins
53 | duplicate-finder-maven-plugin
54 | @project.version@
55 |
56 | true
57 | true
58 |
62 | false
63 | false
64 | true
65 |
66 |
67 |
68 | verify
69 |
70 | check
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail-diff-content/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:first-diff-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate (but equal) classes"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail-equal-content/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = success
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail-equal-content/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-diff-fail-equal-content
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | second-equal-jar
43 | 1.0
44 |
45 |
46 |
47 |
48 | verify
49 |
50 |
51 |
52 | com.ning.maven.plugins
53 | duplicate-finder-maven-plugin
54 | @project.version@
55 |
56 | true
57 | true
58 |
62 | false
63 | false
64 | true
65 |
66 |
67 |
68 | verify
69 |
70 | check
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail-equal-content/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate (but equal) classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:second-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-equal-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate and different classes"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-diff-fail
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | first-diff-jar
43 | 1.0
44 |
45 |
46 |
47 |
48 | verify
49 |
50 |
51 |
52 | com.ning.maven.plugins
53 | duplicate-finder-maven-plugin
54 | @project.version@
55 |
56 | true
57 | true
58 |
62 | false
63 | false
64 | true
65 |
66 |
67 |
68 | verify
69 |
70 | check
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-diff-fail/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:first-diff-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate (but equal) classes"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail-diff-content/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail-diff-content/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-equal-fail-diff-content
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | first-diff-jar
43 | 1.0
44 |
45 |
46 |
47 |
48 | verify
49 |
50 |
51 |
52 | com.ning.maven.plugins
53 | duplicate-finder-maven-plugin
54 | @project.version@
55 |
56 | true
57 | true
58 |
62 | false
63 | false
64 | true
65 |
66 |
67 |
68 | verify
69 |
70 | check
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail-diff-content/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:first-diff-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate (but equal) classes"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail-equal-content/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail-equal-content/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-equal-fail-equal-content
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | second-equal-jar
43 | 1.0
44 |
45 |
46 |
47 |
48 | verify
49 |
50 |
51 |
52 | com.ning.maven.plugins
53 | duplicate-finder-maven-plugin
54 | @project.version@
55 |
56 | true
57 | true
58 |
62 | false
63 | false
64 | true
65 |
66 |
67 |
68 | verify
69 |
70 | check
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail-equal-content/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate (but equal) classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:second-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-equal-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate and different classes"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-equal-fail
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | second-equal-jar
43 | 1.0
44 |
45 |
46 |
47 |
48 | verify
49 |
50 |
51 |
52 | com.ning.maven.plugins
53 | duplicate-finder-maven-plugin
54 | @project.version@
55 |
56 | true
57 | true
58 |
62 | false
63 | false
64 | true
65 |
66 |
67 |
68 | verify
69 |
70 | check
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-equal-fail/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate (but equal) classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:second-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-equal-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate and different classes"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-fail/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-fail/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-class-conflict-fail
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-class-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-class-jar
38 | 1.0
39 |
40 |
41 | com.ning.maven.plugins.duplicate-finder-maven-plugin
42 | first-diff-jar
43 | 1.0
44 |
45 |
46 | com.ning.maven.plugins.duplicate-finder-maven-plugin
47 | second-equal-jar
48 | 1.0
49 |
50 |
51 |
52 |
53 | verify
54 |
55 |
56 |
57 | com.ning.maven.plugins
58 | duplicate-finder-maven-plugin
59 | @project.version@
60 |
61 | true
62 | true
63 |
71 | false
72 | false
73 | true
74 |
75 |
76 |
77 | verify
78 |
79 | check
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/src/it/test-class-conflict-fail/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:first-diff-jar:1.0]",
27 | "[WARNING] Found duplicate (but equal) classes in [com.ning.maven.plugins.duplicate-finder-maven-plugin:second-class-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-equal-jar:1.0]"
28 | ]
29 |
30 | def excludeMessages = [
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-default-print-equal/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = success
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-default-print-equal/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-default-print-equal
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 | true
52 |
61 | false
62 | false
63 | true
64 |
65 |
66 |
67 | verify
68 |
69 | check
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-default-print-equal/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]",
27 | "[WARNING] Found duplicate (but equal) resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
28 | ]
29 |
30 | def excludeMessages = [
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-default/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = success
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-default/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-default
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 |
61 | false
62 | false
63 | true
64 |
65 |
66 |
67 | verify
68 |
69 | check
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-default/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate (but equal) resources"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail-diff-content/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail-diff-content/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-diff-fail-diff-content
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 | true
52 | true
53 |
54 | conflict-same-content
55 |
56 |
60 | false
61 | false
62 | true
63 |
64 |
65 |
66 | verify
67 |
68 | check
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail-diff-content/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate (but equal) resources"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail-equal-content/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = success
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail-equal-content/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-diff-fail-equal-content
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 | true
52 | true
53 |
54 | conflict-different-content
55 |
56 |
60 | false
61 | false
62 | true
63 |
64 |
65 |
66 | verify
67 |
68 | check
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail-equal-content/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate (but equal) resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate and different resources"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-diff-fail
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 | true
52 | true
53 |
54 | conflict-same-content
55 |
56 |
60 | false
61 | false
62 | true
63 |
64 |
65 |
66 | verify
67 |
68 | check
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-diff-fail/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate (but equal) resources"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail-diff-content/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail-diff-content/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-equal-fail-diff-content
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 | true
52 | true
53 |
54 | conflict-same-content
55 |
56 |
60 | false
61 | false
62 | true
63 |
64 |
65 |
66 | verify
67 |
68 | check
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail-diff-content/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate (but equal) resources"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail-equal-content/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail-equal-content/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-equal-fail-equal-content
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 | true
52 | true
53 |
54 | conflict-different-content
55 |
56 |
60 | false
61 | false
62 | true
63 |
64 |
65 |
66 | verify
67 |
68 | check
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail-equal-content/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate (but equal) resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate and different resources"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-equal-fail
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 | true
52 | true
53 |
54 | conflict-different-content
55 |
56 |
60 | false
61 | false
62 | true
63 |
64 |
65 |
66 | verify
67 |
68 | check
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-equal-fail/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate (but equal) resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
27 | ]
28 |
29 | def excludeMessages = [
30 | "Found duplicate and different resources"
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-fail/invoker.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2010 Ning, Inc.
3 | #
4 | # Ning licenses this file to you under the Apache License, version 2.0
5 | # (the "License"); you may not use this file except in compliance with the
6 | # License. You may obtain a copy of the License at:
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | # License for the specific language governing permissions and limitations
14 | # under the License.
15 | #
16 |
17 | invoker.goals=clean verify
18 | invoker.buildResult = failure
19 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-fail/pom.xml:
--------------------------------------------------------------------------------
1 |
16 |
18 |
19 | 4.0.0
20 |
21 | com.ning.maven.plugins.duplicate-finder-maven-plugin
22 | test-resource-conflict-fail
23 | @project.version@
24 |
25 |
26 | UTF-8
27 |
28 |
29 |
30 |
31 | com.ning.maven.plugins.duplicate-finder-maven-plugin
32 | first-jar
33 | 1.0
34 |
35 |
36 | com.ning.maven.plugins.duplicate-finder-maven-plugin
37 | second-jar
38 | 1.0
39 |
40 |
41 |
42 |
43 | verify
44 |
45 |
46 |
47 | com.ning.maven.plugins
48 | duplicate-finder-maven-plugin
49 | @project.version@
50 |
51 | true
52 | true
53 |
61 | false
62 | false
63 | true
64 |
65 |
66 |
67 | verify
68 |
69 | check
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/it/test-resource-conflict-fail/verify.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | import com.google.common.io.CharStreams
18 |
19 | def buildFileReader = new FileReader(new File(basedir, "build.log").getCanonicalFile())
20 | def buildLogLines = CharStreams.readLines(buildFileReader)
21 |
22 | def linefilter = {line -> line.startsWith("[INFO]") || line.startsWith("[WARNING]") || line.startsWith("[ERROR]")}
23 | def relevantLogLines = buildLogLines.findAll(linefilter).reverse()
24 |
25 | def includeMessages = [
26 | "[WARNING] Found duplicate and different resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]",
27 | "[WARNING] Found duplicate (but equal) resources in [com.ning.maven.plugins.duplicate-finder-maven-plugin:first-jar:1.0,com.ning.maven.plugins.duplicate-finder-maven-plugin:second-jar:1.0]"
28 | ]
29 |
30 | def excludeMessages = [
31 | ]
32 |
33 | includeMessages.each() { message ->
34 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
35 | assert found != null, "Did not find '" + message + "' in the build output!"
36 | }
37 |
38 | excludeMessages.each() { message ->
39 | def found = relevantLogLines.find() { line -> return line.indexOf(message) >= 0 }
40 | assert found == null, "Found '" + message + "' in the build output!"
41 | }
42 |
43 | return true
44 |
--------------------------------------------------------------------------------
/src/main/java/com/ning/maven/plugins/duplicatefinder/ClasspathDescriptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.ning.maven.plugins.duplicatefinder;
17 |
18 | import java.io.File;
19 | import java.io.FileNotFoundException;
20 | import java.io.IOException;
21 | import java.io.InputStream;
22 | import java.util.ArrayList;
23 | import java.util.Collections;
24 | import java.util.HashMap;
25 | import java.util.HashSet;
26 | import java.util.List;
27 | import java.util.Map;
28 | import java.util.Set;
29 | import java.util.TreeMap;
30 | import java.util.regex.Pattern;
31 | import java.util.regex.PatternSyntaxException;
32 | import java.util.zip.ZipEntry;
33 | import java.util.zip.ZipInputStream;
34 |
35 | import org.apache.commons.io.FilenameUtils;
36 | import org.apache.commons.io.IOUtils;
37 | import org.apache.maven.plugin.MojoExecutionException;
38 |
39 | public class ClasspathDescriptor
40 | {
41 | private static final Pattern[] DEFAULT_IGNORED_RESOURCES = { Pattern.compile("(META-INF/)?ASL2\\.0(\\.TXT)?"),
42 | Pattern.compile("META-INF/DEPENDENCIES(\\.TXT)?"),
43 | Pattern.compile("META-INF/DISCLAIMER(\\.TXT)?"),
44 | Pattern.compile("(META-INF/)?[A-Z_-]*LICENSE.*"),
45 | Pattern.compile("META-INF/MANIFEST\\.MF"),
46 | Pattern.compile("META-INF/INDEX\\.LIST"),
47 | Pattern.compile("META-INF/MAVEN/.*"),
48 | Pattern.compile("META-INF/PLEXUS/.*"),
49 | Pattern.compile("META-INF/SERVICES/.*"),
50 | Pattern.compile("(META-INF/)?NOTICE(\\.TXT)?"),
51 | Pattern.compile("META-INF/README"),
52 | Pattern.compile("OSGI-INF/.*"),
53 | Pattern.compile("README(\\.TXT)?"),
54 | Pattern.compile(".*PACKAGE\\.HTML"),
55 | Pattern.compile(".*OVERVIEW\\.HTML"),
56 | Pattern.compile("META-INF/SPRING\\.HANDLERS"),
57 | Pattern.compile("META-INF/SPRING\\.SCHEMAS"),
58 | Pattern.compile("META-INF/SPRING\\.TOOLING") };
59 |
60 | private static final Set IGNORED_LOCAL_DIRECTORIES = new HashSet();
61 |
62 | private static final Map CACHED_BY_ELEMENT = new HashMap();
63 |
64 | static {
65 | IGNORED_LOCAL_DIRECTORIES.add(".GIT");
66 | IGNORED_LOCAL_DIRECTORIES.add(".SVN");
67 | IGNORED_LOCAL_DIRECTORIES.add(".HG");
68 | IGNORED_LOCAL_DIRECTORIES.add(".BZR");
69 | }
70 |
71 | private final Map> classesWithElements = new TreeMap>();
72 |
73 | private final Map> resourcesWithElements = new TreeMap>();
74 |
75 | private boolean useDefaultResourceIgnoreList = true;
76 |
77 | private Pattern[] ignoredResourcesPatterns = null;
78 |
79 | public boolean isUseDefaultResourceIgnoreList()
80 | {
81 | return useDefaultResourceIgnoreList;
82 | }
83 |
84 | public void setUseDefaultResourceIgnoreList(final boolean useDefaultResourceIgnoreList)
85 | {
86 | this.useDefaultResourceIgnoreList = useDefaultResourceIgnoreList;
87 | }
88 |
89 | public void setIgnoredResources(final String[] ignoredResources) throws MojoExecutionException
90 | {
91 | if (ignoredResources != null) {
92 | ignoredResourcesPatterns = new Pattern[ignoredResources.length];
93 |
94 | try {
95 | for (int i = 0; i < ignoredResources.length; i++) {
96 | ignoredResourcesPatterns[i] = Pattern.compile(ignoredResources[i].toUpperCase());
97 | }
98 | }
99 | catch (final PatternSyntaxException pse) {
100 | throw new MojoExecutionException("Error compiling resourceIgnore pattern: " + pse.getMessage());
101 | }
102 | }
103 | }
104 |
105 | public void add(final File element) throws IOException
106 | {
107 | if (!element.exists()) {
108 | throw new FileNotFoundException("Path " + element + " doesn't exist");
109 | }
110 | if (element.isDirectory()) {
111 | addDirectory(element);
112 | }
113 | else {
114 | addArchive(element);
115 | }
116 | }
117 |
118 | public Set getClasss()
119 | {
120 | return Collections.unmodifiableSet(classesWithElements.keySet());
121 | }
122 |
123 | public Set getResources()
124 | {
125 | return Collections.unmodifiableSet(resourcesWithElements.keySet());
126 | }
127 |
128 | public Set getElementsHavingClass(final String className)
129 | {
130 | final Set elements = classesWithElements.get(className);
131 |
132 | return elements == null ? null : Collections.unmodifiableSet(elements);
133 | }
134 |
135 | public Set getElementsHavingResource(final String resource)
136 | {
137 | final Set elements = resourcesWithElements.get(resource);
138 |
139 | return elements == null ? null : Collections.unmodifiableSet(elements);
140 | }
141 |
142 | private void addDirectory(final File element)
143 | {
144 | addDirectory(element, null, element);
145 | }
146 |
147 | private void addDirectory(final File element, final String parentPackageName, final File directory)
148 | {
149 | if (addCached(element)) {
150 | return;
151 | }
152 |
153 | final List classes = new ArrayList();
154 | final List resources = new ArrayList();
155 | final File[] files = directory.listFiles();
156 | final String pckgName = element.equals(directory) ? null : (parentPackageName == null ? "" : parentPackageName + ".") + directory.getName();
157 |
158 | if (files != null && files.length > 0) {
159 | for (int idx = 0; idx < files.length; idx++) {
160 | if (files[idx].isDirectory() && !IGNORED_LOCAL_DIRECTORIES.contains(files[idx].getName().toUpperCase())) {
161 | addDirectory(element, pckgName, files[idx]);
162 | }
163 | else if (files[idx].isFile()) {
164 | if ("class".equals(FilenameUtils.getExtension(files[idx].getName()))) {
165 | final String className = (pckgName == null ? "" : pckgName + ".") + FilenameUtils.getBaseName(files[idx].getName());
166 |
167 | classes.add(className);
168 | addClass(className, element);
169 | }
170 | else {
171 | final String resourcePath = (pckgName == null ? "" : pckgName.replace('.', '/') + "/") + files[idx].getName();
172 |
173 | resources.add(resourcePath);
174 | addResource(resourcePath, element);
175 | }
176 | }
177 | }
178 | }
179 |
180 | CACHED_BY_ELEMENT.put(element, new Cached(classes, resources));
181 | }
182 |
183 | private void addArchive(final File element) throws IOException
184 | {
185 | if (addCached(element)) {
186 | return;
187 | }
188 |
189 | final List classes = new ArrayList();
190 | final List resources = new ArrayList();
191 | InputStream input = null;
192 | ZipInputStream zipInput = null;
193 |
194 | try {
195 | input = element.toURI().toURL().openStream();
196 | zipInput = new ZipInputStream(input);
197 |
198 | ZipEntry entry;
199 |
200 | while ((entry = zipInput.getNextEntry()) != null) {
201 | if (!entry.isDirectory()) {
202 | final String name = entry.getName();
203 |
204 | if ("class".equals(FilenameUtils.getExtension(name))) {
205 | final String className = FilenameUtils.removeExtension(name).replace('/', '.').replace('\\', '.');
206 |
207 | classes.add(className);
208 | addClass(className, element);
209 | }
210 | else {
211 | final String resourcePath = name.replace('\\', File.separatorChar);
212 |
213 | resources.add(resourcePath);
214 | addResource(resourcePath, element);
215 | }
216 | }
217 | }
218 |
219 | CACHED_BY_ELEMENT.put(element, new Cached(classes, resources));
220 | }
221 | finally {
222 | if (zipInput != null) {
223 | // this will also close the wrapped stream
224 | IOUtils.closeQuietly(zipInput);
225 | }
226 | else if (input != null) {
227 | IOUtils.closeQuietly(input);
228 | }
229 | }
230 | }
231 |
232 | private void addClass(final String className, final File element)
233 | {
234 | if (className.indexOf('$') < 0) {
235 | Set elements = classesWithElements.get(className);
236 |
237 | if (elements == null) {
238 | elements = new HashSet();
239 | classesWithElements.put(className, elements);
240 | }
241 | elements.add(element);
242 | }
243 | }
244 |
245 | private void addResource(final String path, final File element)
246 | {
247 | if (!ignore(path)) {
248 | Set elements = resourcesWithElements.get(path);
249 |
250 | if (elements == null) {
251 | elements = new HashSet();
252 | resourcesWithElements.put(path, elements);
253 | }
254 | elements.add(element);
255 | }
256 | }
257 |
258 | private boolean ignore(final String path)
259 | {
260 | final String uppercasedPath = path.toUpperCase().replace(File.separatorChar, '/');
261 |
262 | // Unless it has been turned off...
263 | if (useDefaultResourceIgnoreList) {
264 | // check whether the path is in the list of default ignores
265 | for (int idx = 0; idx < DEFAULT_IGNORED_RESOURCES.length; idx++) {
266 | if (DEFAULT_IGNORED_RESOURCES[idx].matcher(uppercasedPath).matches()) {
267 | return true;
268 | }
269 | }
270 | }
271 |
272 | // check whether there is an user supplied ignore pattern.
273 | if (ignoredResourcesPatterns != null) {
274 | for (int idx = 0; idx < ignoredResourcesPatterns.length; idx++) {
275 | if (ignoredResourcesPatterns[idx].matcher(uppercasedPath).matches()) {
276 | return true;
277 | }
278 | }
279 | }
280 |
281 | return false;
282 | }
283 |
284 | private boolean addCached(final File element)
285 | {
286 | final Cached cached = CACHED_BY_ELEMENT.get(element);
287 |
288 | if (cached == null) {
289 | return false;
290 | }
291 |
292 | for (String className : cached.getClasses()) {
293 | addClass(className, element);
294 | }
295 |
296 | for (String resourceName : cached.getResources()) {
297 | addResource(resourceName, element);
298 | }
299 |
300 | return true;
301 | }
302 |
303 | private static class Cached
304 | {
305 | private final List classes;
306 | private final List resources;
307 |
308 | private Cached(final List classes, final List resources)
309 | {
310 | this.classes = classes;
311 | this.resources = resources;
312 | }
313 |
314 | public List getClasses()
315 | {
316 | return classes;
317 | }
318 |
319 | public List getResources()
320 | {
321 | return resources;
322 | }
323 | }
324 | }
325 |
--------------------------------------------------------------------------------
/src/main/java/com/ning/maven/plugins/duplicatefinder/DependencyWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.ning.maven.plugins.duplicatefinder;
17 |
18 | import org.apache.commons.lang.StringUtils;
19 | import org.apache.maven.artifact.Artifact;
20 | import org.apache.maven.artifact.versioning.ArtifactVersion;
21 | import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
22 | import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
23 | import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
24 | import org.apache.maven.artifact.versioning.VersionRange;
25 | import org.apache.maven.model.Dependency;
26 |
27 | public class DependencyWrapper
28 | {
29 | private final Dependency dependency;
30 | private final VersionRange versionRange;
31 |
32 | public DependencyWrapper(final Dependency dependency) throws InvalidVersionSpecificationException
33 | {
34 | this.dependency = dependency;
35 | this.versionRange = VersionRange.createFromVersionSpec(dependency.getVersion());
36 | }
37 |
38 | @Override
39 | public String toString()
40 | {
41 | String result = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion();
42 |
43 | if (dependency.getType() != null && !"jar".equals(dependency.getType())) {
44 | result = result + ":" + dependency.getType();
45 | }
46 | if (dependency.getClassifier() != null && (!"tests".equals(dependency.getClassifier()) || !"test-jar".equals(dependency.getType()))) {
47 | result = result + ":" + dependency.getClassifier();
48 | }
49 | return result;
50 | }
51 |
52 | public boolean matches(final Artifact artifact)
53 | {
54 | ArtifactVersion version;
55 |
56 | try {
57 | if (artifact.getVersionRange() != null) {
58 | version = artifact.getSelectedVersion();
59 | }
60 | else {
61 | version = new DefaultArtifactVersion(artifact.getVersion());
62 | }
63 | }
64 | catch (final OverConstrainedVersionException ex) {
65 | return false;
66 | }
67 |
68 | return StringUtils.equals(dependency.getGroupId(), artifact.getGroupId()) &&
69 | StringUtils.equals(dependency.getArtifactId(), artifact.getArtifactId()) &&
70 | StringUtils.equals(StringUtils.defaultIfEmpty(dependency.getType(), "jar"), StringUtils.defaultIfEmpty(artifact.getType(), "jar")) &&
71 | StringUtils.equals(dependency.getClassifier(), artifact.getClassifier()) &&
72 | (versionRange == null || versionRange.containsVersion(version) || StringUtils.equals(artifact.getVersion(), dependency.getVersion()));
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/ning/maven/plugins/duplicatefinder/Exception.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.ning.maven.plugins.duplicatefinder;
17 |
18 | import java.util.ArrayList;
19 | import java.util.Arrays;
20 | import java.util.Collection;
21 | import java.util.Collections;
22 | import java.util.HashSet;
23 | import java.util.List;
24 | import java.util.Set;
25 | import java.util.regex.Pattern;
26 |
27 | import org.apache.commons.lang.StringUtils;
28 | import org.apache.maven.artifact.Artifact;
29 | import org.apache.maven.artifact.versioning.ArtifactVersion;
30 | import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
31 | import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
32 | import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
33 | import org.apache.maven.artifact.versioning.VersionRange;
34 | import org.apache.maven.model.Dependency;
35 |
36 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
37 |
38 | @SuppressFBWarnings("BAD_PRACTICE")
39 | public class Exception
40 | {
41 | public static final String CURRENT_PROJECT_IDENTIFIER = "";
42 |
43 | private DependencyWrapper[] conflictingDependencies;
44 | private boolean currentProject;
45 | private final Set classes = new HashSet();
46 | private final Set packages = new HashSet();
47 | private final Set resources = new HashSet();
48 | private Pattern[] matchingResources = new Pattern[0];
49 |
50 | public void setConflictingDependencies(final Dependency[] conflictingDependencies) throws InvalidVersionSpecificationException
51 | {
52 | this.conflictingDependencies = new DependencyWrapper[conflictingDependencies.length];
53 | for (int idx = 0; idx < conflictingDependencies.length; idx++) {
54 | this.conflictingDependencies[idx] = new DependencyWrapper(conflictingDependencies[idx]);
55 | }
56 | }
57 |
58 | public void setResourcePatterns(final String[] resourcePatterns)
59 | {
60 | this.matchingResources = new Pattern[resourcePatterns.length];
61 | for (int i = 0; i < resourcePatterns.length; i++) {
62 | this.matchingResources[i] = Pattern.compile(resourcePatterns[i], Pattern.CASE_INSENSITIVE);
63 | }
64 | }
65 |
66 | public boolean isCurrentProject()
67 | {
68 | return currentProject;
69 | }
70 |
71 | public void setCurrentProject(final boolean currentProject)
72 | {
73 | this.currentProject = currentProject;
74 | }
75 |
76 | public String[] getClasses()
77 | {
78 | return classes.toArray(new String[classes.size()]);
79 | }
80 |
81 | public void setClasses(final String[] classes)
82 | {
83 | this.classes.addAll(Arrays.asList(classes));
84 | }
85 |
86 | public String[] getPackages()
87 | {
88 | return packages.toArray(new String[packages.size()]);
89 | }
90 |
91 | public void setPackages(final String[] packages)
92 | {
93 | this.packages.addAll(Arrays.asList(packages));
94 | }
95 |
96 | public String[] getResources()
97 | {
98 | return resources.toArray(new String[resources.size()]);
99 | }
100 |
101 | public void setResources(final String[] resources)
102 | {
103 | this.resources.addAll(Arrays.asList(resources));
104 | }
105 |
106 | public List getDependencyNames()
107 | {
108 | final List result = new ArrayList();
109 |
110 | if (conflictingDependencies != null) {
111 | for (int idx = 0; idx < conflictingDependencies.length; idx++) {
112 | result.add(conflictingDependencies[idx].toString());
113 | }
114 | }
115 | if (currentProject) {
116 | result.add(CURRENT_PROJECT_IDENTIFIER);
117 | }
118 | Collections.sort(result);
119 | return result;
120 | }
121 |
122 | public boolean isForArtifacts(final Collection artifacts, final Artifact projectArtifact)
123 | {
124 | int numMatches = 0;
125 |
126 | for (Artifact artifact : artifacts) {
127 | if (conflictingDependencies != null) {
128 | for (int idx = 0; idx < conflictingDependencies.length; idx++) {
129 | if (conflictingDependencies[idx].matches(artifact)) {
130 | numMatches++;
131 | }
132 | else if (currentProject && currentProjectDependencyMatches(artifact, projectArtifact)) {
133 | numMatches++;
134 | }
135 | }
136 | }
137 | }
138 | return numMatches == artifacts.size();
139 | }
140 |
141 | private boolean currentProjectDependencyMatches(final Artifact artifact, final Artifact projectArtifact)
142 | {
143 | final VersionRange versionRange = projectArtifact.getVersionRange();
144 | ArtifactVersion version;
145 |
146 | try {
147 | if (artifact.getVersionRange() != null) {
148 | version = artifact.getSelectedVersion();
149 | }
150 | else {
151 | version = new DefaultArtifactVersion(artifact.getVersion());
152 | }
153 | }
154 | catch (final OverConstrainedVersionException ex) {
155 | return false;
156 | }
157 |
158 | return StringUtils.equals(projectArtifact.getGroupId(), artifact.getGroupId()) &&
159 | StringUtils.equals(projectArtifact.getArtifactId(), artifact.getArtifactId()) &&
160 | StringUtils.equals(StringUtils.defaultIfEmpty(projectArtifact.getType(), "jar"), StringUtils.defaultIfEmpty(artifact.getType(), "jar")) &&
161 | StringUtils.equals(projectArtifact.getClassifier(), artifact.getClassifier()) &&
162 | (versionRange != null && versionRange.containsVersion(version) || artifact.getVersion().equals(projectArtifact.getVersion()));
163 | }
164 |
165 | public boolean containsClass(final String className)
166 | {
167 | if (classes.contains(className)) {
168 | return true;
169 | }
170 | else {
171 | for (String packageName : packages) {
172 | if (className.startsWith(packageName)) {
173 | return true;
174 | }
175 | }
176 | return false;
177 | }
178 | }
179 |
180 | public boolean containsResource(final String resource)
181 | {
182 | final String resourceAsRelative = resource.startsWith("/") || resource.startsWith("\\") ? resource.substring(1) : resource;
183 |
184 | if (resources.contains(resourceAsRelative) ||
185 | resources.contains("/" + resourceAsRelative) ||
186 | resources.contains("\\" + resourceAsRelative)) {
187 |
188 | return true;
189 | }
190 |
191 | for (int i = 0; i < matchingResources.length; i++) {
192 | if (matchingResources[i].matcher(resourceAsRelative).matches()) {
193 | return true;
194 | }
195 | }
196 |
197 | return false;
198 | }
199 | }
200 |
--------------------------------------------------------------------------------
/src/main/java/com/ning/maven/plugins/duplicatefinder/ToStringComparator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Ning, Inc.
3 | *
4 | * Ning licenses this file to you under the Apache License, version 2.0
5 | * (the "License"); you may not use this file except in compliance with the
6 | * License. You may obtain a copy of the License at:
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 | package com.ning.maven.plugins.duplicatefinder;
17 |
18 | import java.io.Serializable;
19 | import java.util.Comparator;
20 |
21 | public class ToStringComparator implements Comparator