Every time I try to run a build, I get a bunch of lines like this:
/Users/Shared/Jenkins/Home/jobs/dghhtreew/workspace/build.xml:28:
The following error occurred while executing this line:
/Users/Shared/Jenkins/Home/jobs/dghhtreew/workspace/build.xml:39: Execute failed: java.io.IOException: Cannot run program "pdepend": error=2, No such file or directory
Here's the relevant part from my build.xml, which was auto-generated by PHP Project Wizard:
...
<target name="parallelTasks" description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs"/>
<antcall target="phpdoc"/>
<antcall target="phploc"/>
</parallel>
</target>
<target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
<exec executable="pdepend">
<arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml
--jdepend-chart=${basedir}/build/pdepend/dependencies.svg
--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg
${source}" />
</exec>
</target>
...
Apparently the Jenkins user cannot find these commands or something. When I log in via the terminal to Jenkins like this:
sudo -s -H -u jenkins
and try pdepend it works as expected. But for some reason it won't work when executed from the Jenkins server. I tried setting absolute paths in the executable line, but I just got the same result. I haven't messed with the install or anything, I have the latest version (1.488) of Jenkins via the mac installer.
Why can't jenkins do anything??
This is an execution path problem with the exec task. Try specifying the entire path to the pdepend command.
<exec executable="/complete/path/to/command/pdepend">
..
Update
If this still doesn't work check the permissions on the pdepend command to ensure that it's executable by the jenkins user.
It's also worth checking the return code when running the pdepend command directly:
sudo -u jenkins /complete/path/to/command/pdepend || echo non-zero return code
Maybe you don't have installed commands, so for me easiest way is via composer:
composer global require 'pdepend/pdepend=*'
If you don't have composer, install it:
curl -sS https://getcomposer.org/installer | php
php composer.phar global require 'pdepend/pdepend=*'
Jenkins let's to ad path variables, you don't need to add paths
Please click "Manage Jenkins"
Click Configure System
Find checkbox "Environment variables" and make sure it is checked
Add new:
name: PATH
value: $PATH:/Users/YOUR_USER/.composer/vendor/bin
Related
Trying to make my sumo simulation work on OMNeT++, but when modifying .launchd.xml i couldn't give permission to running sumo.
I'm currently using Ubuntu 18.04.2 LTS, sumo 0.32.0, Veins 4.7.1 and OMNeT++ 5.3.
I've searched for means to make a sumo simulation different from the erlangen example work. Until this point what I have found was modifying the erlangen.launchd.xml file to make it run my simulation and running
sudo python sumo-launchd.py -vv -c /home/gustavo/Downloads/sumo-0.32.0/bin/
However, everytime I tried to run it a message saying it lost connection appeared, so I tried creating a poly.xml archive with nothing in it (because I didn't want any buildings or something like that in the simulation) and it didn't work. I looked into the linux terminal and saw a message saying there was no sumo.cfg archive in the sumo-0.32.0/bin folder (I don't understand why it should, there is no .sumo.cfg archive from the erlangen example on that folder too), so I copied all the archives for the simulation (.net .rou .sumo.cfg and .poly) into the folder and tried again. This problem was solved but another error showed up in the terminal:
Could not start SUMO (/home/gustavo/Downloads/sumo-0.32.0/bin/ -c simulation.sumo.cfg): [Errno 13] Permission denied
I tried running it the command with sudo but it didn't solved it. Does anyone know how to make it work or another way of making my own sumo simulation work in OMNeT++?
<?xml version="1.0"?>
<!-- debug config -->
<launch>
<copy file="simulation.net.xml" />
<copy file="simulation.rou.xml" />
<copy file="simulation.poly.xml" />
<copy file="simulation.sumo.cfg" type="config" />
</launch>
I hoped to make my sumo simulation work on OMNeT++ because any other website that I looked didn't show that problem.
The parameter -c for the sumo-launchd expects the full path to the executable so you need to include sumo at the end:
sudo python sumo-launchd.py -vv -c /home/gustavo/Downloads/sumo-0.32.0/bin/sumo
Maven is well installed on my gitlab-runner server. When executing mvn clean directly on my repo it works, when running my pipeline using Gitlab UI got this error :
bash: line 60: mvn: command not found
ERROR: Job failed: exit status 1
I notice that I tried to fix the problem by adding the before_script section in the .gitlab-ci.yml file :
before_script:
- export MAVEN_HOME=/usr/local/apache-maven
I add also the line :
environment = ["MAVEN_HOME=/usr/local/apache-maven"]
on the config.toml file.
the problem still persist, my executor is : shell.
Any advice!
I managed to fix the problem using this workaround:
script:
- $MAVEN_HOME/bin/mvn clean
Just add the maven docker image, add below line as first line:
image: maven:latest or image: maven:3-jdk-10 or image: maven:3-jdk-9
refer: https://docs.gitlab.com/ee/ci/examples/artifactory_and_gitlab/
For anyone experiencing similar issues, it might be a good idea to restart the gitlab runner ".\gitlab-runner.exe restart". Especially after fiddling with environmental variables.
There is an easier way:
Making changes in ~/.bash_profile not ~/.bashrc.
According to this document:
.bashrc it is more common to use a non-login shell
This document saying:
For certain executors, the runner passes the --login flag as shown above, which also loads the shell profile.
So it should not be ~/.bashrc, you can also try ~/.profile which It can hold the same configurations, which are then also accessible by other shells
In my scenario I do following things:
1. Set gitlab-runner's user password.
passwd gitlab-runner
2. Login gitlab-runner.
su - gitlab-runner
3. Make changes in .bash_profile
Add maven to PATH:
$ export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
$ export M2=$M2_HOME/bin
$ export PATH=$M2:$PATH
You can include these commands in $HOME/.bashrc
I hope you had figure out your question. I met the same question when I build my ci on my server.
I use the shell as the executer for my Runner.
here are the steps to figure out.
1 check the user on the runner server
if you had install maven on the runner server successfully, maybe it just successful for the root, u can check the real user for the ci process.
job1:
stage: test
script: whoami
if my case, it print gitlab-runner, not the root
2 su the real user, check mvn again
In this time, it print error as same as the Gitlab ci UI.
3 install maven for the real user. run the pipeline again.
You can also use as per below in the .gitlab-ci.yml
before_script:
- export PATH=$PATH:/opt/apache-maven-3.8.1/bin
I'm trying to setup Jenkins to build a cordova 3.4 project but I'm getting a 'command not found' error when I try to run 'cordova prepare' as an Execute Shell command in Jenkins. I know cordova is installed on the machine but I don't know how to add it so that Jenkins can find it.
Can anyone help?
Best way to modify PATH is to go to Jenkins global (or slave) configuration and add environment variable PATH and it's desired value under "Environment variables" section.
Try this: https://stackoverflow.com/a/30905787/6437038
TLDR: add #!/bin/bash -l in the beginning of the jenkins job
We have an Ant script with a chown task as follows:
<chown owner="${user}" verbose="true">
<fileset dir="${dev-home}" includes="**/**"/>
<dirset dir="${dev-home}" includes="**/**"/>
</chown>
The task is failing, but just says that it fails without stating why or giving the command that was being executed. How can we debug this?
You may run your Ant file in debug mode by:
ant -debug -f yourbuildfile.xml
For debugging specific parts use the techniques described in this thread: Make ant quiet without the -q flag?
Check also Ant's manual for chown task which reads:
If you are working on a large number of files this may result in a command line that is too long for your operating system. If you encounter such problems, you should set the maxparallel attribute of this task to a non-zero value. The number to use highly depends on the length of your file names (the depth of your directory tree) and your operating system, so you'll have to experiment a little.
I am trying to use my ftp server on netbeans. Is there a way to only put the host and username + password in and then just see all the folders that are on the server?
I already searched for this but I can't seem to find it anywhere.
I am using a mac and netBeans 7.1.1
First, ensure that ant-commons-net.jar is copied to:
C:\Program Files (x86)\NetBeans 6.7.1\java2\modules\ext
Then modify your project's build-impl.xml file, located under the nbproject directory.
Add a new task, such as this, using your ftpsite, username, and pass. Keep that file safe unless you modify it to prompt each time. To execute, run the ftp task by expanding the build.xml from the NB files tree tab.
Code:
====================
FTP SECTION
====================
-->
<target depends="jar" description="Build." name="ftp">
<ftp server="FTPSITEURLHERE" userid="USERIDHERE" password="PASSWORDHERE">
<fileset file="${dist.dir}/${application.title}.jar" />
</ftp>
</target>
<!--
I'm not sure what you mean, you want to create some project from FTP server and don't want to specify exact path? If so you can leave upload directory with just "/" and the same of "initial directory" and it should work