code: private boolean shouldWritePackageInfo( File directory )
      {
          if ( !directory.isDirectory() )
              return false;
  
          if (!directory.exists())
              return false;
  
          // legacy behavior: if mPackageRootDir is a sub-dir of mSrcRootPath, an explicit package was specified
          if(isChild(new File(mSrcRootPath), mPackageRootDir)) {
              
              // return true if 'directory' passed in equals() or is a child of mPackageRootDir
              return mPackageRootDir.equals(directory) || isChild(mPackageRootDir, directory);
              
          } else {  // only return true if 'directory' passed in contains at least one file
  
              File[] files = directory.listFiles( new FileFilter()
              {
                  public boolean accept( File pathname )
                  {
                      return pathname.isFile();
                  }
              } );
  
              return files != null && files.length > 0;
          }
      }
docs: Tests if a PackageInfo.java file should be written in the directory passed in.
  
  If the File passed in is not a directory or is not writable, false is returned.
  If an explicit starting package is specified to the mojo (the legacy behavior), true is returned if
  the directory passed in is a sub-package of that root package.
  If an explicit starting package is NOT specified, true will only be returned if the directory passed in
  contains at least one file.
  
  @param directory The directory to write package info to.
  @return returns true if a PackageInfo.java should be written.