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

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


        final MockAndControlForGetDistroName mac =
            new MockAndControlForGetDistroName( finalName, appendAssemblyId, classifier );

        mockManager.replayAll();

        final Assembly assembly = new Assembly();
        assembly.setId( assemblyId );

        final String result = AssemblyFormatUtils.getDistributionName( assembly, mac.configSource );

        assertEquals( checkValue, result );
View Full Code Here


    }

    public void testShouldNotFailWhenNoFileSetsSpecified()
        throws ArchiveCreationException, AssemblyFormattingException
    {
        final Assembly assembly = new Assembly();

        assembly.setId( "test" );

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

    }

    public void testShouldAddOneFileSet()
        throws ArchiveCreationException, AssemblyFormattingException
    {
        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 =
            new MockAndControlForAddFileSetsTask( mockManager, fileManager );
View Full Code Here

        final File tempRoot = fileManager.createTempDir();

        macCS.expectGetTemporaryRootDirectory( tempRoot );

        final Assembly assembly = new Assembly();

        assembly.setId( "test" );

        mm.replayAll();

        createPhase( macRepo.repositoryAssembler, new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ).execute( assembly,
                                                                                                             macArchiver.archiver,
View Full Code Here

        macCS.expectGetTemporaryRootDirectory( tempRoot );
        macCS.expectGetProject( new MavenProject( new Model() ) );
        macCS.expectGetFinalName( "final-name" );

        final Assembly assembly = new Assembly();

        assembly.setId( "test" );

        final Repository repo = new Repository();

        repo.setOutputDirectory( "out" );
        repo.setDirectoryMode( "777" );
        repo.setFileMode( "777" );

        final int mode = TypeConversionUtils.modeToInt( "777", new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );

        final File outDir = new File( tempRoot, "out" );

        macArchiver.expectModeChange( -1, -1, mode, mode, true );
        macArchiver.expectAddDirectory( outDir, "out/", null, null );

        macRepo.expectAssemble( outDir, repo, macCS.configSource );

        assembly.addRepository( repo );

        mm.replayAll();

        createPhase( macRepo.repositoryAssembler, new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ).execute( assembly,
                                                                                                             macArchiver.archiver,
View Full Code Here

        // check unique IDs
        final Set<String> ids = new HashSet<String>();
        for ( final Iterator<Assembly> i = assemblies.iterator(); i.hasNext(); )
        {
            final Assembly assembly = i.next();
            if ( !ids.add( assembly.getId() ) )
            {
                getLogger().warn( "The assembly id " + assembly.getId() + " is used more than once." );
            }

        }
        return assemblies;
    }
View Full Code Here

        }

        try
        {
            // TODO use ReaderFactory.newXmlReader() when plexus-utils is upgraded to 1.4.5+
            final Assembly assembly =
                readAssembly( new InputStreamReader( resourceAsStream, "UTF-8" ), ref, null, configSource );

            assemblies.add( assembly );
            return assembly;
        }
View Full Code Here

        Reader r = null;
        try
        {
            // TODO use ReaderFactory.newXmlReader() when plexus-utils is upgraded to 1.4.5+
            r = new InputStreamReader( new FileInputStream( descriptor ), "UTF-8" );
            final Assembly assembly =
                readAssembly( r, descriptor.getAbsolutePath(), descriptor.getParentFile(), configSource );

            assemblies.add( assembly );

            return assembly;
View Full Code Here

            if ( location.getFile() != null )
            {
                dir = location.getFile().getParentFile();
            }

            final Assembly assembly = readAssembly( r, spec, dir, configSource );

            assemblies.add( assembly );

            return assembly;
        }
View Full Code Here

    protected Assembly readAssembly( final Reader reader, final String locationDescription, final File assemblyDir,
                                     final AssemblerConfigurationSource configSource )
        throws AssemblyReadException, InvalidAssemblerConfigurationException
    {
        Assembly assembly;

        final File basedir = configSource.getBasedir();
        final MavenProject project = configSource.getProject();

        try
        {
            final Map<String, String> context = new HashMap<String, String>();
            final MavenSession session = configSource.getMavenSession();

            Properties commandLineProperties = System.getProperties();
            if ( session != null )
            {
                commandLineProperties = new Properties();
                if ( session.getExecutionProperties() != null )
                {
                    commandLineProperties.putAll( session.getExecutionProperties() );
                }

                if ( session.getUserProperties() != null )
                {
                    commandLineProperties.putAll( session.getUserProperties() );
                }
            }

            for ( final Enumeration<Object> e = commandLineProperties.keys(); e.hasMoreElements(); )
            {
                final String key = (String) e.nextElement();
                if ( key == null || key.trim().length() < 1 )
                {
                    continue;
                }

                context.put( key, commandLineProperties.getProperty( key ) );
            }

            context.put( "basedir", basedir.getAbsolutePath() );

            final AssemblyXpp3Reader r = new AssemblyXpp3Reader();
            assembly = r.read( reader );

            mergeComponentsWithMainAssembly( assembly, assemblyDir, configSource );

            debugPrintAssembly( "Before assembly is interpolated:", assembly );

            assembly = new AssemblyInterpolator().interpolate( assembly, project, configSource );

            debugPrintAssembly( "After assembly is interpolated:", assembly );
        }
        catch ( final IOException e )
        {
            throw new AssemblyReadException(
                                             "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
                                             e );
        }
        catch ( final XmlPullParserException e )
        {
            throw new AssemblyReadException(
                                             "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
                                             e );
        }
        catch ( final AssemblyInterpolationException e )
        {
            throw new AssemblyReadException(
                                             "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
                                             e );
        }
        finally
        {
            IOUtil.close( reader );
        }

        if ( configSource.isSiteIncluded() || assembly.isIncludeSiteDirectory() )
        {
            includeSiteInAssembly( assembly, configSource );
        }

        return assembly;
View Full Code Here

TOP

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

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.