"Unable to write log file" error running JUnit batch files with Ant
I have resolved the above error with some trial and error but not sure whether this will work 100% for others or not, but what I did I am sharing my experience.
Steps
- service jenkins stop or sudo /etc/init.d/jenkins stop
- Make sure all services are stopped. Even u should not be able toaccess the jenkins url from browser.
- check the rpm -qa|grep jenkins. It will show your jenkins rpmpackage.
Run the find / -name jenkins to check where and all jenkins is used.
[root@localhost]# find / -name "jenkins"
/etc/rc.d/init.d/jenkins
/etc/logrotate.d/jenkins
/etc/sysconfig/jenkins
/usr/lib/jenkins
/var/lib/jenkins
/var/cache/jenkins
/var/cache/yum/jenkins
/var/log/jenkins
[root@localhost]#
Take backup of /var/lib/jenkins/ folders to /var/lib/jenkins.old
Now run the "rpm -e --nodeps jenkins-1.651.3-1.1" to remove thepackage.
Repeat Step 4 again and make sure /var/cache/jenkins and/var/cache/yum/jenkins are the two directories which remains
Now run "rpm -ivh /etc/yum.repos.d/jenkins-1.651.3-1.1.noarch.rpm"to install the jenkins package
Run "service jenkins start" so that it will listen on port 8080
Open the jenkins url with IP and Port.
Create a free-style project with some name and make sure the project should be created in /var/lib/jenkins/jobs/project_name
Configure the necessary steps such as JDK Installation, Ant installations etc., in manage jenkins options.
Now run the build for your project without configuring build.xml path, so that it will create a workspace folder in /var/lib/jenkins/workspace/project_name
Now copy the build.xml file from existing project and put the file in /var/lib/jenkins/workspace/project_name
Build project from Jenkins.
Try to resolve script label errors such as it will complain for lib, src folders not found and copy/create those folders to resolve the compilation errors.
Once done with all errors try to run the build again so that you will get Build Successful.
Make sure you copy/create src and lib folder and don't copy/create the target folder.
Make sure target folder must be created automatically by Jenkins with jenkins ownership and jenkins file permission. Rest all may be root owner and root file permission.
Now configure the junit report and email notifications to get the build reports in email.