src/main/java/com/simpligility/maven/plugins/android/phase01generatesources/GenerateSourcesMojo.java
private void checkPackagesForDuplicates() throws MojoExecutionException
    {
        Set<Artifact> dependencyArtifacts = getTransitiveDependencyArtifacts( AAR, APKLIB );

        if ( dependencyArtifacts.isEmpty() )
        {
            //if no AAR or APKLIB dependencies presents than only one package presents
            return;
        }

        Map<String, Set<Artifact>> packageCompareMap = getPackageCompareMap( dependencyArtifacts );

        List<String> duplicatesMessageList = new ArrayList<String>();
        for ( Map.Entry<String, Set<Artifact>> entry : packageCompareMap.entrySet() )
        {
            Set<Artifact> artifacts = entry.getValue();
            if ( artifacts != null && artifacts.size() > 1 )
            {
                StringBuilder messageBuilder = new StringBuilder();
                for ( Artifact item : artifacts )
                {
                    messageBuilder
                            .append( messageBuilder.length() > 0 ? ", " : "    [" )
                            .append( item.getArtifactId() );
                }
                messageBuilder
                        .append( "] have similar package='" )
                        .append( entry.getKey() )
                        .append( "'" );
                duplicatesMessageList.add( messageBuilder.toString() );
            }
        }
        if ( !duplicatesMessageList.isEmpty() )
        {
            List<String> messageList = new ArrayList<String>();
            messageList.add( "" );
            messageList.add( "Duplicate packages detected in AndroidManifest.xml files" );
            messageList.add( "" );
            messageList.add( "Such scenario generally means that the build will fail with a compilation error due to"
                    + " missing resources in R file." );
            messageList.add( "You should consider renaming some of the duplicate packages listed below"
                    + " to avoid the conflict." );
            messageList.add( "" );
            messageList.add( "Conflicting artifacts:" );
            messageList.addAll( duplicatesMessageList );
            messageList.add( "" );

            if ( failOnDuplicatePackages )
            {
                StringBuilder builder = new StringBuilder();
                for ( String line : messageList )
                {
                    builder.append( line );
                    builder.append( "\n" );
                }
                builder.append( "\n" );
                builder.append( "You can downgrade the failure to a warning " );
                builder.append( "by setting the 'failOnDuplicatePackages' plugin property to false." );
                throw new MojoExecutionException( builder.toString() );
            }
            for ( String messageLine : messageList )
            {
                getLog().warn( messageLine );
            }
        }
    }
private void checkPackagesForDuplicates() throws MojoExecutionException
    {
        Set<Artifact> dependencyArtifacts = getTransitiveDependencyArtifacts( AAR, APKLIB );

        if ( dependencyArtifacts.isEmpty() )
        {
            //if no AAR or APKLIB dependencies presents than only one package presents
            return;
        }

        Map<String, Set<Artifact>> packageCompareMap = getPackageCompareMap( dependencyArtifacts );

        List<String> duplicatesMessageList = new ArrayList<String>();
        for ( Map.Entry<String, Set<Artifact>> entry : packageCompareMap.entrySet() )
        {
            Set<Artifact> artifacts = entry.getValue();
            if ( artifacts != null && artifacts.size() > 1 )
            {
                StringBuilder messageBuilder = new StringBuilder();
                for ( Artifact item : artifacts )
                {
                    messageBuilder
                            .append( messageBuilder.length() > 0 ? ", " : "    [" )
                            .append( item.getArtifactId() );
                }
                messageBuilder
                        .append( "] have similar package='" )
                        .append( entry.getKey() )
                        .append( "'" );
                duplicatesMessageList.add( messageBuilder.toString() );
            }
        }
        if ( !duplicatesMessageList.isEmpty() )
        {
            List<String> messageList = new ArrayList<String>();
            messageList.add( "" );
            messageList.add( "Duplicate packages detected in AndroidManifest.xml files" );
            messageList.add( "" );
            messageList.add( "Such scenario generally means that the build will fail with a compilation error due to"
                    + " missing resources in R file." );
            messageList.add( "You should consider renaming some of the duplicate packages listed below"
                    + " to avoid the conflict." );
            messageList.add( "" );
            messageList.add( "Conflicting artifacts:" );
            messageList.addAll( duplicatesMessageList );
            messageList.add( "" );

            if ( failOnDuplicatePackages )
            {
                StringBuilder builder = new StringBuilder();
                for ( String line : messageList )
                {
                    builder.append( line );
                    builder.append( "\n" );
                }
                builder.append( "\n" );
                builder.append( "You can downgrade the failure to a warning " );
                builder.append( "by setting the 'failOnDuplicatePackages' plugin property to false." );
                throw new MojoExecutionException( builder.toString() );
            }
            for ( String messageLine : messageList )
            {
                getLog().warn( messageLine );
            }
        }
    }
Checks packages in AndroidManifest.xml file of project and all dependent libraries for duplicates.
<p>Generate warning if duplicates presents.
<p>(in case of packages similarity R.java and BuildConfig files will be overridden)

@throws MojoExecutionException