Commit 0b9d3e29 by zhongmh

升级了版本,增加了多目录配置

parent 9a3a87b7
......@@ -6,7 +6,7 @@
<groupId>cn.yunmaozj.tools</groupId>
<artifactId>maven-site-upload-parent</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<description>站点上传插件</description>
<modules>
<module>site-upload-maven-plugin</module>
......@@ -17,7 +17,6 @@
<properties>
<mavenVersion>3.0</mavenVersion>
<javaVersion>8</javaVersion>
</properties>
<repositories>
<repository>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>maven-site-upload-parent</artifactId>
<groupId>cn.yunmaozj.tools</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>maven-site-upload-parent</artifactId>
<groupId>cn.yunmaozj.tools</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
package cn.yunmaozj.upload;
import org.apache.maven.plugins.annotations.Parameter;
import java.io.File;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author zhongminghong
* @email yunmaozj@163.com
* @create 2019-09-11 9:57
*/
public class Directories {
@Parameter(property = "fileList", required = true)
private Set<File> directories = new HashSet<>();
public Set<File> getFileList() {
return directories;
}
public void addDirectory(File file) {
this.directories.add(file);
}
}
......@@ -22,10 +22,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Stack;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* @author zhongminghong
......@@ -37,8 +33,8 @@ public class SiteUploadMojo extends AbstractMojo {
@Parameter(property = "skip", defaultValue = "false")
private boolean skip;
@Parameter(property = "inputDirectory", defaultValue = "${project.version}", required = true)
private File inputDirectory;
@Parameter(property = "directories", required = true)
private Directories directories;
@Parameter(property = "proxyHost")
private String proxyHost;
@Parameter(property = "proxyPort")
......@@ -73,18 +69,19 @@ public class SiteUploadMojo extends AbstractMojo {
getLog().info("the project packaging is pom");
return;
}
if (!inputDirectory.exists()) {
getLog().info("资源目录不存在[" + inputDirectory + "]");
return;
}
getLog().info("输入目录:" + inputDirectory);
try {
File outFile = compress();
uploader(outFile);
} catch (IOException e) {
e.printStackTrace();
for (File inputDirectory : directories.getFileList()) {
if (!inputDirectory.exists()) {
getLog().info("资源目录不存在[" + inputDirectory + "]");
return;
}
getLog().info("输入目录:" + inputDirectory);
try {
File outFile = compress(inputDirectory);
uploader(outFile);
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
......@@ -141,7 +138,7 @@ public class SiteUploadMojo extends AbstractMojo {
/**
* 压缩文件
*/
private File compress() throws IOException {
private File compress(File inputDirectory) throws IOException {
Stack<File> directoryStack = new Stack<>();
directoryStack.push(inputDirectory);
File currentDirectoryFile = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment