code: protected void addDirectory( JarArchiver jarArchiver, File directory, String prefix )
      {
          if ( directory != null && directory.exists() )
          {
              final DefaultFileSet fileSet = new DefaultFileSet();
              fileSet.setPrefix( endWithSlash( prefix ) );
              fileSet.setDirectory( directory );
  
              // XXX: trying to avoid duplicated sources
              fileSet.setExcludes( new String[] { "**/R.java", "**/BuildConfig.java" } );
  
              jarArchiver.addFileSet( fileSet );
              getLog().debug( "Added files from " + directory );
          }
      }
docs: Adds a directory to a {@link JarArchiver} with a directory prefix.
  
  @param jarArchiver
  @param directory   The directory to add.
  @param prefix      An optional prefix for where in the Jar file the directory's contents should go.