Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Tar$TarCompressionMethod


        AntUtil.execute(zip);
        return this;
    }

    public TestFile tarTo(TestFile zipFile) {
        Tar tar = new Tar();
        tar.setBasedir(this);
        tar.setDestFile(zipFile);
        AntUtil.execute(tar);
        return this;
    }
View Full Code Here


            zipTask.execute();
        }
        // TAR Archive
        else if ( archiveType.equalsIgnoreCase( "tar" ) )
        {
            Tar tarTask = new Tar();
            tarTask.setProject( project );
            tarTask.setDestFile( finalFile );
            tarTask.setBasedir( getTargetDirectory() );
            tarTask.setIncludes( getArchiveDirectory().getName() + "/**" );
            tarTask.execute();
        }
        // TAR.GZ Archive
        else if ( archiveType.equalsIgnoreCase( "tar.gz" ) )
        {
            File tarFile = new File( mojo.getOutputDirectory(), target.getId() + ".tar" );

            Tar tarTask = new Tar();
            tarTask.setProject( project );
            tarTask.setDestFile( tarFile );
            tarTask.setBasedir( getTargetDirectory() );
            tarTask.setIncludes( getArchiveDirectory().getName() + "/**" );
            tarTask.execute();

            GZip gzipTask = new GZip();
            gzipTask.setProject( project );
            gzipTask.setDestfile( finalFile );
            gzipTask.setSrc( tarFile );
            gzipTask.execute();

            if ( !tarFile.delete() )
            {
                Exception e = new IOException( I18n.err( I18n.ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY, tarFile ) );
                log.error( e.getLocalizedMessage() );
                throw new MojoFailureException( e.getMessage() );
            }
        }
        // TAR.BZ2 Archive
        else if ( archiveType.equalsIgnoreCase( "tar.bz2" ) )
        {
            File tarFile = new File( mojo.getOutputDirectory(), target.getId() + ".tar" );

            Tar tarTask = new Tar();
            tarTask.setProject( project );
            tarTask.setDestFile( tarFile );
            tarTask.setBasedir( getTargetDirectory() );
            tarTask.setIncludes( getArchiveDirectory().getName() + "/**" );
            tarTask.execute();

            BZip2 bzip2Task = new BZip2();
            bzip2Task.setProject( project );
            bzip2Task.setDestfile( finalFile );
            bzip2Task.setSrc( tarFile );
View Full Code Here

            zipTask.execute();
        }
        // TAR Archive
        else if ( archiveType.equalsIgnoreCase( "tar" ) )
        {
            Tar tarTask = new Tar();
            tarTask.setProject( project );
            tarTask.setDestFile( new File( imagesDirectory, target.getFinalName() ) );
            tarTask.setBasedir( targetDirectory );
            tarTask.setIncludes( archiveDirectory.getName() + "/**" );
            tarTask.execute();
        }
        // TAR.GZ Archive
        else if ( archiveType.equalsIgnoreCase( "tar.gz" ) )
        {
            File tarFile = new File( imagesDirectory, target.getId() + ".tar" );

            Tar tarTask = new Tar();
            tarTask.setProject( project );
            tarTask.setDestFile( tarFile );
            tarTask.setBasedir( targetDirectory );
            tarTask.setIncludes( archiveDirectory.getName() + "/**" );
            tarTask.execute();

            GZip gzipTask = new GZip();
            gzipTask.setProject( project );
            gzipTask.setDestfile( new File( imagesDirectory, target.getFinalName() ) );
            gzipTask.setSrc( tarFile );
            gzipTask.execute();

            tarFile.delete();
        }
        // TAR.BZ2 Archive
        else if ( archiveType.equalsIgnoreCase( "tar.bz2" ) )
        {
            File tarFile = new File( imagesDirectory, target.getId() + ".tar" );

            Tar tarTask = new Tar();
            tarTask.setProject( project );
            tarTask.setDestFile( tarFile );
            tarTask.setBasedir( targetDirectory );
            tarTask.setIncludes( archiveDirectory.getName() + "/**" );
            tarTask.execute();

            BZip2 bzip2Task = new BZip2();
            bzip2Task.setProject( project );
            bzip2Task.setDestfile( new File( imagesDirectory, target.getFinalName() ) );
            bzip2Task.setSrc( tarFile );
View Full Code Here

        String serverName = artifact.getArtifactId() + "-" + artifact.getVersion();
        dest = new File(dest, serverName + "-bin." + artifact.getType());
        Project project = new Project();
        MatchingTask archiver;
        if ("tar.gz".equals(artifact.getType())) {
            Tar tar = new Tar();
            Tar.TarCompressionMethod tarCompressionMethod = new Tar.TarCompressionMethod();
            tarCompressionMethod.setValue("gzip");
            tar.setCompression(tarCompressionMethod);
            Tar.TarLongFileMode fileMode = new Tar.TarLongFileMode();
            fileMode.setValue(Tar.TarLongFileMode.GNU);
            tar.setLongfile(fileMode);
            tar.setDestFile(dest);
            TarFileSet rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setExcludes("bin/");
            tar.add(rc);

            rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setIncludes("bin/");
            rc.setExcludes("bin/*.bat");
            rc.setFileMode("755");
            tar.add(rc);

            rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setIncludes("bin/*.bat");
            tar.add(rc);

            archiver = tar;
        } else if ("zip".equals(artifact.getType())) {
            Zip zip = new Zip();
            zip.setDestFile(dest);
View Full Code Here

        String serverName = artifact.getArtifactId() + "-" + artifact.getVersion();
        dest = new File(dest, serverName + "." + artifact.getType());
        Project project = new Project();
        MatchingTask archiver;
        if ("tar.gz".equals(artifact.getType())) {
            Tar tar = new Tar();
            Tar.TarCompressionMethod tarCompressionMethod = new Tar.TarCompressionMethod();
            tarCompressionMethod.setValue("gzip");
            tar.setCompression(tarCompressionMethod);
            Tar.TarLongFileMode fileMode = new Tar.TarLongFileMode();
            fileMode.setValue(Tar.TarLongFileMode.GNU);
            tar.setLongfile(fileMode);
            tar.setDestFile(dest);
            TarFileSet rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setExcludes("bin/");
            tar.add(rc);

            rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setIncludes("bin/");
            rc.setExcludes("bin/*.bat");
            rc.setFileMode("755");
            tar.add(rc);

            rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setIncludes("bin/*.bat");
            tar.add(rc);

            for (Resource resource: this.project.getResources()) {
                File resourceFile = new File(resource.getDirectory());
                if (resourceFile.exists()) {
                    rc = new TarFileSet();
                    rc.setPrefix(serverName);
                    rc.setProject(project);
                    rc.setDir(resourceFile);
                    rc.appendIncludes(resource.getIncludes().toArray(new String[0]));
                    rc.appendExcludes(resource.getExcludes().toArray(new String[0]));
                    tar.add(rc);
                }
            }

            archiver = tar;
        } else if ("zip".equals(artifact.getType())) {
View Full Code Here

        return allPassed;
    }

    private void bzipTestResults(File dir) {
        File destFile = new File(dir, "results.tar.bz2");
        Tar bzipTask = new Tar();
        Tar.TarCompressionMethod bzip2 = new Tar.TarCompressionMethod();
        bzip2.setValue("bzip2");
        bzipTask.setCompression(bzip2);
        bzipTask.setProject(new Project());
        bzipTask.setDestFile(destFile);
        FileSet fs = bzipTask.createTarFileSet();
        fs.setDir(dir);
        fs.setIncludes("*.html");
        bzipTask.execute();
        log.info("bzipped test results: " + destFile.getAbsolutePath());
    }
View Full Code Here

        String serverName = artifact.getArtifactId() + "-" + artifact.getVersion();
        dest = new File(dest, serverName + "." + artifact.getType());
        Project project = new Project();
        MatchingTask archiver;
        if ("tar.gz".equals(artifact.getType())) {
            Tar tar = new Tar();
            Tar.TarCompressionMethod tarCompressionMethod = new Tar.TarCompressionMethod();
            tarCompressionMethod.setValue("gzip");
            tar.setCompression(tarCompressionMethod);
            Tar.TarLongFileMode fileMode = new Tar.TarLongFileMode();
            fileMode.setValue(Tar.TarLongFileMode.GNU);
            tar.setLongfile(fileMode);
            tar.setDestFile(dest);
            TarFileSet rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setExcludes("bin/");
            tar.add(rc);

            rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setIncludes("bin/");
            rc.setExcludes("bin/*.bat");
            rc.setFileMode("755");
            tar.add(rc);

            rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setIncludes("bin/*.bat");
            tar.add(rc);

            for (Resource resource: this.project.getResources()) {
                File resourceFile = new File(resource.getDirectory());
                if (resourceFile.exists()) {
                    rc = new TarFileSet();
                    rc.setPrefix(serverName);
                    rc.setProject(project);
                    rc.setDir(resourceFile);
                    rc.appendIncludes(resource.getIncludes().toArray(new String[0]));
                    rc.appendExcludes(resource.getExcludes().toArray(new String[0]));
                    tar.add(rc);
                }
            }

            archiver = tar;
        } else if ("zip".equals(artifact.getType())) {
View Full Code Here

        return allPassed;
    }

    private void bzipTestResults(File dir) {
        File destFile = new File(dir, "results.tar.bz2");
        Tar bzipTask = new Tar();
        Tar.TarCompressionMethod bzip2 = new Tar.TarCompressionMethod();
        bzip2.setValue("bzip2");
        bzipTask.setCompression(bzip2);
        bzipTask.setProject(new Project());
        bzipTask.setDestFile(destFile);
        FileSet fs = bzipTask.createTarFileSet();
        fs.setDir(dir);
        fs.setIncludes("*.html");
        bzipTask.execute();
        log.info("bzipped test results: " + destFile.getAbsolutePath());
    }
View Full Code Here

        String serverName = artifact.getArtifactId() + "-" + artifact.getVersion();
        dest = new File(dest, serverName + "-bin." + artifact.getType());
        Project project = new Project();
        MatchingTask archiver;
        if ("tar.gz".equals(artifact.getType())) {
            Tar tar = new Tar();
            Tar.TarCompressionMethod tarCompressionMethod = new Tar.TarCompressionMethod();
            tarCompressionMethod.setValue("gzip");
            tar.setCompression(tarCompressionMethod);
            Tar.TarLongFileMode fileMode = new Tar.TarLongFileMode();
            fileMode.setValue(Tar.TarLongFileMode.GNU);
            tar.setLongfile(fileMode);
            tar.setDestFile(dest);
            TarFileSet rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setExcludes("bin/");
            tar.add(rc);

            rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setIncludes("bin/");
            rc.setExcludes("bin/*.bat");
            rc.setFileMode("755");
            tar.add(rc);

            rc = new TarFileSet();
            rc.setDir(source);
            rc.setPrefix(serverName);
            rc.setProject(project);
            rc.setIncludes("bin/*.bat");
            tar.add(rc);

            archiver = tar;
        } else if ("zip".equals(artifact.getType())) {
            Zip zip = new Zip();
            zip.setDestFile(dest);
View Full Code Here

        return allPassed;
    }

    private void bzipTestResults(File dir) {
        File destFile = new File(dir, "results.tar.bz2");
        Tar bzipTask = new Tar();
        Tar.TarCompressionMethod bzip2 = new Tar.TarCompressionMethod();
        bzip2.setValue("bzip2");
        bzipTask.setCompression(bzip2);
        bzipTask.setProject(new Project());
        bzipTask.setDestFile(destFile);
        FileSet fs = bzipTask.createTarFileSet();
        fs.setDir(dir);
        fs.setIncludes("*.html");
        bzipTask.execute();
        log.info("bzipped test results: " + destFile.getAbsolutePath());
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Tar$TarCompressionMethod

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.