protected void addJavaResource( JarArchiver jarArchiver, Resource javaResource, String prefix )
            throws IOException
    {
        if ( javaResource != null )
        {
            final File javaResourceDirectory = new File( javaResource.getDirectory() );
            if ( javaResourceDirectory.exists() )
            {
                final String resourcePath = javaResourceDirectory.getCanonicalPath();
                final String apkLibUnpackBasePath = getUnpackedLibsDirectory().getCanonicalPath();
                // Don't include our dependencies' resource dirs.
                if ( ! resourcePath.startsWith( apkLibUnpackBasePath ) )
                {
                    final DefaultFileSet javaResourceFileSet = new DefaultFileSet();
                    javaResourceFileSet.setDirectory( javaResourceDirectory );
                    javaResourceFileSet.setPrefix( endWithSlash( prefix ) );
                    jarArchiver.addFileSet( javaResourceFileSet );
                }
            }
        }
    }
protected void addJavaResource( JarArchiver jarArchiver, Resource javaResource, String prefix )
            throws IOException
    {
        if ( javaResource != null )
        {
            final File javaResourceDirectory = new File( javaResource.getDirectory() );
            if ( javaResourceDirectory.exists() )
            {
                final String resourcePath = javaResourceDirectory.getCanonicalPath();
                final String apkLibUnpackBasePath = getUnpackedLibsDirectory().getCanonicalPath();
                
                if ( ! resourcePath.startsWith( apkLibUnpackBasePath ) )
                {
                    final DefaultFileSet javaResourceFileSet = new DefaultFileSet();
                    javaResourceFileSet.setDirectory( javaResourceDirectory );
                    javaResourceFileSet.setPrefix( endWithSlash( prefix ) );
                    jarArchiver.addFileSet( javaResourceFileSet );
                }
            }
        }
    }
protected void addJavaResource ( JarArchiver jarArchiver , Resource javaResource , String prefix ) throws IOException { if ( javaResource != null ) { final File javaResourceDirectory = new File ( javaResource . getDirectory ( ) ) ; if ( javaResourceDirectory . exists ( ) ) { final String resourcePath = javaResourceDirectory . getCanonicalPath ( ) ; final String apkLibUnpackBasePath = getUnpackedLibsDirectory ( ) . getCanonicalPath ( ) ; // Don't include our dependencies' resource dirs. if ( ! resourcePath . startsWith ( apkLibUnpackBasePath ) ) { final DefaultFileSet javaResourceFileSet = new DefaultFileSet ( ) ; javaResourceFileSet . setDirectory ( javaResourceDirectory ) ; javaResourceFileSet . setPrefix ( endWithSlash ( prefix ) ) ; jarArchiver . addFileSet ( javaResourceFileSet ) ; } } } }
Adds a Java Resources directory (typically "src/main/resources") to a {@link JarArchiver}.

@param jarArchiver
@param javaResource The Java resource to add.
@param prefix       An optional prefix for where in the Jar file the directory's contents should go.
@throws IOException in case the resource path can not be resolved
Adds a Java Resources directory ( typically src / main / resources ) to a { @link JarArchiver } .