简体   繁体   中英

Maven builds in Jenkins failing, succeeding on command line

We are customizing the site generation in maven and one of the things that it does is call Visio to have it translate some charts into png. We use a vbs script which calls Visio and that is called from a java class by calling Process proc = Runtime.getRuntime().exec(command); where command is cmd /c "cd "C:\\Path\\To\\Module\\site\\target\\staging"&&exportVisioSvg.vbs "C:\\Path\\To\\inFile.vsd" "C:\\Path\\To\\outFile.png""

Now this code executes on my own machine just fine. Visio is called up and generates a file. When I run it on the server hosting our Jenkins instance it works as well. When I run the command by itself it works just fine. Finally when I goto the Jenkins\\workspace and execute the maven build there it works just fine.

However when I run the build in jenkins with exactly the same command (I copied and pasted it) it does not generate the Visio charts. Everything else runs fine and there is no stack trace outside of our own thrown error that goes off when the image is not where it is supposed to be. The exit code from the process is 0 as well and there is no output to either stdout or stderr (the windows equivalent) generated by the process and it has to complete or the exit code would be -1. Timeout isn't a problem as it has 50000 ms to run but always returns within a sec or less (you can see the error get thrown right after the call to the script).

I switched Jenkins to run under the admin account where everything is installed (moving it from SYSTEM) so it should have access to the PATH.

I have no idea what to do at this point.

This sounds like one of the Jenkins FAQs. Check https://wiki.jenkins-ci.org/display/JENKINS/My+software+builds+on+my+computer+but+not+on+Jenkins especially under the section "Desktop access (Windows)"

您可能正在访问http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6468220 ,由于无法在JDK中对其进行修复,因此您需要在代码中对其进行优化。

The problem is when Visio is started it is started as a child of the Jenkins service which is running without desktop interaction. Microsoft restricts its office product actions where a prompt might be generated which cannot be seen by a user. Even if you add allow interaction with desktop it will not work and in my case returned the following error value 2032466051. The solution was to only run it as a user and manually start the Jenkins instance every time we needed to restart the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM