Package org.apache.maven.plugin.assembly.model

Examples of org.apache.maven.plugin.assembly.model.FileSet


    public void testShouldReturnOriginalUnalteredDirectoryWhenIncludedFileSetIsEmpty()
        throws AssemblyFormattingException, IOException
    {
        final File dir = fileManager.createTempDir();

        final FileSet fs = new FileSet();

        fs.setLineEnding( AssemblyFileUtils.LINE_ENDING_LF );
        fs.setDirectory( dir.getCanonicalPath() );
        fs.addExclude( "**/*" );

        final FileSetFormatter formatter = new FileSetFormatter( configSource, logger );

        final File result = formatter.formatFileSetForAssembly( dir, fs );

View Full Code Here


        final String filename2 = "two.txt";

        fileManager.createFile( dir, filename1, "Hello\nThis is a test." );
        fileManager.createFile( dir, filename2, "Hello\nThis is also a test." );

        final FileSet fs = new FileSet();

        fs.setLineEnding( AssemblyFileUtils.LINE_ENDING_CRLF );
        fs.setDirectory( dir.getCanonicalPath() );
        fs.addInclude( "**/*.txt" );

        final FileSetFormatter formatter = new FileSetFormatter( configSource, logger );

        configSource.getTemporaryRootDirectory();
        configSourceControl.setReturnValue( dir );
View Full Code Here

        final String filename2 = "two.txt";

        fileManager.createFile( dir, filename1, "Hello\nThis is a test." );
        fileManager.createFile( dir, filename2, "Hello\nThis is also a test." );

        final FileSet fs = new FileSet();

        fs.setLineEnding( AssemblyFileUtils.LINE_ENDING_CRLF );
        fs.setDirectory( dir.getCanonicalPath() );
        fs.addExclude( "**/two.txt" );

        final FileSetFormatter formatter = new FileSetFormatter( configSource, logger );

        configSource.getTemporaryRootDirectory();
        configSourceControl.setReturnValue( dir );
View Full Code Here

        final String filename2 = "two.txt";

        fileManager.createFile( dir, filename1, "Hello\nThis is a test." );
        fileManager.createFile( dir, filename2, "Hello\nThis is also a test." );

        final FileSet fs = new FileSet();

        fs.setLineEnding( AssemblyFileUtils.LINE_ENDING_CRLF );
        fs.setDirectory( dir.getCanonicalPath() );
        fs.addInclude( "**/one.txt" );

        final FileSetFormatter formatter = new FileSetFormatter( configSource, logger );

        configSource.getTemporaryRootDirectory();
        configSourceControl.setReturnValue( dir );
View Full Code Here

        final String filename2 = "CVS/two.txt";

        fileManager.createFile( dir, filename1, "Hello\nThis is a test." );
        fileManager.createFile( dir, filename2, "Hello\nThis is also a test." );

        final FileSet fs = new FileSet();

        fs.setLineEnding( AssemblyFileUtils.LINE_ENDING_CRLF );
        fs.setDirectory( dir.getCanonicalPath() );

        final FileSetFormatter formatter = new FileSetFormatter( configSource, logger );

        configSource.getTemporaryRootDirectory();
        configSourceControl.setReturnValue( dir );
View Full Code Here

            }
        }

        for ( final Iterator<FileSet> i = fileSets.iterator(); i.hasNext(); )
        {
            final FileSet fileSet = i.next();

            addFileSet( fileSet, archiver, configSource, archiveBaseDir );
        }
    }
View Full Code Here

        final List<FileSet> fileSets = new ArrayList<FileSet>();

        if ( isDeprecatedModuleSourcesConfigPresent( sources ) )
        {
            final FileSet fs = new FileSet();
            fs.setOutputDirectory( sources.getOutputDirectory() );
            fs.setIncludes( sources.getIncludes() );
            fs.setExcludes( sources.getExcludes() );
            fs.setUseDefaultExcludes( sources.isUseDefaultExcludes() );

            fileSets.add( fs );
        }

        List<FileSet> subFileSets = sources.getFileSets();

        if ( ( subFileSets == null ) || subFileSets.isEmpty() )
        {
            final FileSet fs = new FileSet();
            fs.setDirectory( "src" );

            subFileSets = Collections.singletonList( fs );
        }

        fileSets.addAll( subFileSets );

        for ( final Iterator<MavenProject> j = moduleProjects.iterator(); j.hasNext(); )
        {
            final MavenProject moduleProject = j.next();

            getLogger().info( "Processing sources for module project: " + moduleProject.getId() );

            final List<FileSet> moduleFileSets = new ArrayList<FileSet>();

            for ( final Iterator<FileSet> fsIterator = fileSets.iterator(); fsIterator.hasNext(); )
            {
                final FileSet fileSet = fsIterator.next();

                moduleFileSets.add( createFileSet( fileSet, sources, moduleProject, configSource ) );
            }

            final AddFileSetsTask task = new AddFileSetsTask( moduleFileSets );
View Full Code Here

    protected FileSet createFileSet( final FileSet fileSet, final ModuleSources sources,
                                     final MavenProject moduleProject, final AssemblerConfigurationSource configSource )
        throws AssemblyFormattingException
    {
        final FileSet fs = new FileSet();

        String sourcePath = fileSet.getDirectory();

        final File moduleBasedir = moduleProject.getBasedir();

        if ( sourcePath != null )
        {
            final File sourceDir = new File( sourcePath );

            if ( !sourceDir.isAbsolute() )
            {
                sourcePath = new File( moduleBasedir, sourcePath ).getAbsolutePath();
            }
        }
        else
        {
            sourcePath = moduleBasedir.getAbsolutePath();
        }

        fs.setDirectory( sourcePath );
        fs.setDirectoryMode( fileSet.getDirectoryMode() );

        final List<String> excludes = new ArrayList<String>();

        final List<String> originalExcludes = fileSet.getExcludes();
        if ( ( originalExcludes != null ) && !originalExcludes.isEmpty() )
        {
            excludes.addAll( originalExcludes );
        }

        if ( sources.isExcludeSubModuleDirectories() )
        {
            @SuppressWarnings( "unchecked" )
            final List<String> modules = moduleProject.getModules();
            for ( final Iterator<String> moduleIterator = modules.iterator(); moduleIterator.hasNext(); )
            {
                final String moduleSubPath = moduleIterator.next();

                excludes.add( moduleSubPath + "/**" );
            }
        }

        fs.setExcludes( excludes );
        fs.setFiltered( fileSet.isFiltered() );
        fs.setFileMode( fileSet.getFileMode() );
        fs.setIncludes( fileSet.getIncludes() );
        fs.setLineEnding( fileSet.getLineEnding() );

        String destPathPrefix = "";
        if ( sources.isIncludeModuleDirectory() )
        {
            destPathPrefix =
                AssemblyFormatUtils.evaluateFileNameMapping( sources.getOutputDirectoryMapping(),
                                                             moduleProject.getArtifact(), configSource.getProject(),
                                                             moduleProject, moduleProject.getArtifact(), moduleProject,
                                                             configSource );

            if ( !destPathPrefix.endsWith( "/" ) )
            {
                destPathPrefix += "/";
            }
        }

        String destPath = fileSet.getOutputDirectory();

        if ( destPath == null )
        {
            destPath = destPathPrefix;
        }
        else
        {
            destPath = destPathPrefix + destPath;
        }

        destPath =
            AssemblyFormatUtils.getOutputDirectory( destPath, configSource.getProject(), moduleProject, moduleProject,
                                                    configSource.getFinalName(), configSource );

        fs.setOutputDirectory( destPath );

        getLogger().debug( "module source directory is: " + sourcePath );
        getLogger().debug( "module dest directory is: " + destPath + " (assembly basedir may be prepended)" );

        return fs;
View Full Code Here

        final Assembly assembly = new Assembly();

        assembly.setId( "test" );
        assembly.setIncludeBaseDirectory( false );

        final FileSet fs = new FileSet();
        fs.setOutputDirectory( "/out" );
        fs.setDirectory( "/input" );
        fs.setFileMode( "777" );
        fs.setDirectoryMode( "777" );

        assembly.addFileSet( fs );

        final MockAndControlForLogger macLogger = new MockAndControlForLogger();
        final MockAndControlForAddFileSetsTask macTask =
View Full Code Here

            }
        }

        final UnpackOptions opts = dependencySet.getUnpackOptions();

        final FileSet fs = new FileSet();
        fs.setDirectory( dir.getAbsolutePath() );
        fs.setDirectoryMode( dependencySet.getDirectoryMode() );
        fs.setExcludes( opts.getExcludes() );
        fs.setFileMode( dependencySet.getFileMode() );
        fs.setFiltered( opts.isFiltered() );
        fs.setIncludes( opts.getIncludes() );

        String outDir = dependencySet.getOutputDirectory();
        if ( outDir == null )
        {
            outDir = defaultOutputDirectory;
        }

        String filenameMapping = dependencySet.getOutputFileNameMapping();
        if ( filenameMapping == null )
        {
            filenameMapping = defaultOutputFileNameMapping;
        }

        filenameMapping =
            AssemblyFormatUtils.evaluateFileNameMapping( filenameMapping, depArtifact, configSource.getProject(),
                                                         moduleProject, moduleArtifact, depProject, configSource );

        final String outputLocation = new File( outDir, filenameMapping ).getPath();

        fs.setOutputDirectory( outputLocation );

        fs.setLineEnding( opts.getLineEnding() );
        fs.setUseDefaultExcludes( opts.isUseDefaultExcludes() );

        final AddFileSetsTask task = new AddFileSetsTask( fs );
        task.setProject( depProject );
        task.setModuleProject( moduleProject );
        task.setLogger( logger );
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.assembly.model.FileSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.