1 package com.simpligility.maven.plugins.android.phase_prebuild;
2
3 import java.util.ArrayList;
4 import java.util.List;
5 import java.util.Set;
6
7 import org.apache.maven.artifact.Artifact;
8 import org.codehaus.plexus.logging.Logger;
9
10 class ProvidedDependencyChecker
11 {
12
13 void checkProvidedDependencies( Set<Artifact> artifacts, Logger log )
14 {
15 List<Artifact> conflictingArtifacts = new ArrayList<Artifact>();
16
17 for ( Artifact artifact : artifacts )
18 {
19 if ( artifact.getScope().equals( Artifact.SCOPE_TEST ) )
20 {
21 continue;
22 }
23
24 String group = artifact.getGroupId();
25 String name = artifact.getArtifactId();
26
27 if ( ( "org.apache.httpcomponents".equals( group ) && "httpclient".equals( name ) )
28 || ( "xpp3".equals( group ) && name.equals( "xpp3" ) )
29 || ( "commons-logging".equals( group ) && "commons-logging".equals( name ) )
30 || ( "xerces".equals( group ) && "xmlParserAPIs".equals( name ) ) )
31 {
32 conflictingArtifacts.add( artifact );
33 }
34 if ( "org.json".equals( group ) && "json".equals( name ) )
35 {
36 conflictingArtifacts.add( artifact );
37 }
38 if ( "org.khronos".equals( group ) && "opengl-api".equals( name ) )
39 {
40 conflictingArtifacts.add( artifact );
41 }
42 }
43
44 if ( !conflictingArtifacts.isEmpty() )
45 {
46 log.warn( "The following dependencies may conflict with the "
47 + "internal versions provided by the Android platform:\n" + conflictingArtifacts
48 + "\nIt is recommended to shade these artifacts. " + "You can read more about this here: "
49 + "http://simpligility.github.io/android-maven-plugin/shaded-commons-codec.html.\n"
50 + "Alternatively, you can disable this warning with the"
51 + "'disableConflictingDependenciesWarning' parameter." );
52 }
53 }
54 }