我正在尝试为我公司的一个小项目设置 jenkins 构建服务器。早期的构建是由选定的开发人员在Windows机器上手工制作的。Ant build 在 Windows 上工作正常,但在 Linux 机器(jenkins/jenkins:latest docker 镜像(上无法正常工作。以下是构建失败的步骤:
<mkdir dir="deploy" />
<fx:deploy
embedJNLP="false"
extension="false"
includeDT="false"
offlineAllowed="true"
outdir="${basedir}/deploy"
outfile="FILENAME" nativeBundles="all"
updatemode="background" >
<fx:platform basedir="${JAVA_HOME}"/>
<fx:info title="APPNAME" vendor="PCOMPANYNAME"/>
<fx:application refId="fxApplication" />
<fx:resources refid="appRes"/>
</fx:deploy>
这是 jenkins 控制台的输出:
Do-Deploy:
[echo] ::START:: Deployment process
[mkdir] Created dir: /var/jenkins_home/workspace/XXX/build/dist
[mkdir] Created dir: /var/jenkins_home/workspace/XXX/build/dist/libs
[copy] Copying 32 files to /var/jenkins_home/workspace/XXX/build/dist
[mkdir] Created dir: /var/jenkins_home/workspace/XXX/build/build/classes/META-INF
[mkdir] Created dir: /var/jenkins_home/workspace/XXX/build/deploy
Using base JDK at: /docker-java-home/jre
Using base JDK at: /docker-java-home/jre
Creating app bundle: /var/jenkins_home/workspace/XXX/build/deploy/bundles/XXX
Debian packages should specify a license. The absence of a license will cause some linux distributions to complain about the quality of the application.
[fx:deploy] java.io.IOException: Exec failed with code 2 command [[fakeroot, dpkg-deb, -b, XXX, /var/jenkins_home/workspace/XXX/build/deploy/bundles/XXX.deb] in /tmp/fxbundler6370267168449686200/images/linux-deb.image
[fx:deploy] at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:165)
[fx:deploy] at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:138)
[fx:deploy] at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:132)
[fx:deploy] at com.oracle.tools.packager.linux.LinuxDebBundler.buildDeb(LinuxDebBundler.java:871)
[fx:deploy] at com.oracle.tools.packager.linux.LinuxDebBundler.bundle(LinuxDebBundler.java:363)
[fx:deploy] at com.oracle.tools.packager.linux.LinuxDebBundler.execute(LinuxDebBundler.java:923)
[fx:deploy] at com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:352)
[fx:deploy] at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:319)
[fx:deploy] at com.sun.javafx.tools.ant.DeployFXTask.execute(DeployFXTask.java:286)
[fx:deploy] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
[fx:deploy] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[fx:deploy] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[fx:deploy] at java.lang.reflect.Method.invoke(Method.java:498)
[fx:deploy] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[fx:deploy] at org.apache.tools.ant.Task.perform(Task.java:348)
[fx:deploy] at org.apache.tools.ant.Target.execute(Target.java:435)
[fx:deploy] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[fx:deploy] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
[fx:deploy] at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
[fx:deploy] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[fx:deploy] at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
[fx:deploy] at org.apache.tools.ant.Main.runBuild(Main.java:857)
[fx:deploy] at org.apache.tools.ant.Main.startAnt(Main.java:236)
[fx:deploy] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
[fx:deploy] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
BUILD FAILED
/var/jenkins_home/workspace/XXX/build/build.xml:163: Error: Bundler "DEB Installer" (deb) failed to produce a bundle.
在 Ubuntu 18.04 VM 上存在相同的问题。我迷失了可能出错的地方。
所以我在SO上找到了一个类似的主题。它还涉及 Ubuntu,日志文件还指出该案例可能是fakeroot
尝试将其添加到 Dockerfileapt-get install fakeroot
我说的话题: 无法为 Linux 创建 JavaFX 应用程序.deb包