Write java program compressed Linux local directory

Note: If the picture is damaged, click on the link to the article: https://www.toutiao.com/i6809285459722633736/

Create Project

java compression packing a local directory and then write script execution

 

Use maven project

java compression packing a local directory and then write script execution

 

Checked, then the next step

java compression packing a local directory and then write script execution

 

Basic Information

java compression packing a local directory and then write script execution

 

Note The change coding and JDK

java compression packing a local directory and then write script execution

 

pom configuration (later attached document)

java compression packing a local directory and then write script execution

 

Introducing jar (this package has been unable to download, so additional import)

java compression packing a local directory and then write script execution

 

Create a class run

java compression packing a local directory and then write script execution

 

Write code

java compression packing a local directory and then write script execution

 

java compression packing a local directory and then write script execution

 

Continue to prepare

java compression packing a local directory and then write script execution

 

java compression packing a local directory and then write script execution

 

The main method of testing, to the windows in the test is completed, it is placed on the linux performed facie, the local test is not tested directly packaged

java compression packing a local directory and then write script execution

 

Package, install execution

java compression packing a local directory and then write script execution

 

Since we introduced another package, so our package will be larger than the other packages, make no mistake

java compression packing a local directory and then write script execution

 

This package is

java compression packing a local directory and then write script execution

 

Copy pom, pay attention to change your main class

java compression packing a local directory and then write script execution

 

Change the name to upload

java compression packing a local directory and then write script execution

 

And then execute the statement packing

java -jar zipexe.jar /usr/local/pimages /data/1.tar.gz

java compression packing a local directory and then write script execution

 

Write a script for next execution

java compression packing a local directory and then write script execution

 

Results of the

java compression packing a local directory and then write script execution

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xlgl.wzy</groupId>
<artifactId>mail</artifactId>
<version>0.0.1-SNAPSHOT</version>
 
<dependencies>
 
<dependency> 
<groupId>commonsIO</groupId>   <!--自定义-->
<artifactId>commonsIO</artifactId>  <!--自定义-->
<version>2.5 . 0 </ Version> <-! Custom -> 
<scope> System </ scope> <-! System, similar provided, after the need to provide an explicit dependency jar, Maven will not find in the Repository it -> 
<systemPath>} $ {pom.basedir / JAR / commonsIO- 2.5 . 0 .jar </ systemPath> <-! lib files under the root folder item -> 
</ dependency> 
 
<dependency> 
<the groupId> JUnit </ the groupId> 
<the artifactId> JUnit </ the artifactId> 
<Version> 4.10 </ Version> 
</ dependency> 
 
<dependency> 
<the groupId> log4j </ the groupId> 
<the artifactId> log4j </ the artifactId> 
<Version> 1.2 . . 8 </ Version>
</dependency>
 
 
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.5</version>
</dependency>
 
<!--邮件发送-->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
</dependencies>
 
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.xlgl.wzy.zip.ZipExecute</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
 
 

 


 

Guess you like

Origin www.cnblogs.com/bqwzy/p/12590352.html