Javafx Gradle 使用 lib net.lingala.zip4j 时发生异常 org.gradle.process.internal.ExecException 以非零退出值 1 结束
Javafx Gradle make exception org.gradle.process.internal.ExecException finished with non-zero exit value 1 when use lib net.lingala.zip4j
我曾使用 zip4j
lib net.lingala.zip4j 来构建 winrar 项目 javafx
但出现此错误
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:/Program Files/Java/jdk-11.0.14/bin/java.exe'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:414)
at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:52)
我已经将 lib 添加到 gradle
的依赖项
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '2.9.0'
在文件模块中-info.java 我添加了
module com.example.compresszip {
requires javafx.controls;
requires javafx.fxml;
requires zip4j;
opens com.example.compresszip to javafx.fxml;
exports com.example.compresszip;
}
在主class中我添加了
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.model.enums.CompressionMethod;
public class ZipDemo {
public static final String OUTPUT_ZIP_FILE = "D:\demozip\cms.zip";
public static final String SOURCE_FOLDER = "D:\demozip\cms";
public static final String PASSWORD = "12345";
public static void main(String[] args){
try {
System.out.println("dvadvav");
ZipFile z = new ZipFile(OUTPUT_ZIP_FILE);
z.addFile(new File("D:\demozip\cms\build.gradle"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
在这种情况下我不使用 gradle 但使用 maven 效果很好
我曾使用 zip4j
lib net.lingala.zip4j 来构建 winrar 项目 javafx
但出现此错误
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:/Program Files/Java/jdk-11.0.14/bin/java.exe'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:414)
at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:52)
我已经将 lib 添加到 gradle
的依赖项implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '2.9.0'
在文件模块中-info.java 我添加了
module com.example.compresszip {
requires javafx.controls;
requires javafx.fxml;
requires zip4j;
opens com.example.compresszip to javafx.fxml;
exports com.example.compresszip;
}
在主class中我添加了
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.model.enums.CompressionMethod;
public class ZipDemo {
public static final String OUTPUT_ZIP_FILE = "D:\demozip\cms.zip";
public static final String SOURCE_FOLDER = "D:\demozip\cms";
public static final String PASSWORD = "12345";
public static void main(String[] args){
try {
System.out.println("dvadvav");
ZipFile z = new ZipFile(OUTPUT_ZIP_FILE);
z.addFile(new File("D:\demozip\cms\build.gradle"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
在这种情况下我不使用 gradle 但使用 maven 效果很好