Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Java.nio.file.DirectoryNotEmpt appears in the project build after Jenkins migrates jobs

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. first of all, let's talk about the migration process.

1) the new environment deploys the Jenkins continuous integration environment. The installation process is not described in detail here.

2) transfer the jobs directory under the old Jenkins home directory directly to the new environment by means of scp

Start the new environment Jenkins service after the migration is completed, and the output of the construction project console is as follows:

Observe the console output to the end, the project is built successfully, and does not affect the operation.

2. Cause of error

Through Google search, we know that someone submitted this issues,This started happening on a new Jenkins server that a teammate was trying to setup by cloning an existing one, and I found out that he used scp-r to copy the whole working tree and that resulted in the lastSuccessful and lastStable soft-links to get converted to physical directories. I guess Jenkins was trying to remove it like it is a file (which a soft-link is), but since it turned out to be a directory that is not empty, it is causing this exception. When you remove/rename these directories, it clears the path for Jenkins to recreate the soft-links thus solving the problem. For details of the link, please go to: https://issues.jenkins-ci.org/browse/JENKINS-21330

The translation is as follows:

This started on a new Jenkins server, and my teammate tried to set it up by cloning an existing server, and I found that he used scp-r to copy the entire working tree, which led to the conversion of lastSuccessful and lastStable soft links to physical directories. I guess Jenkins tried to delete it as if it were a file (soft link), but because it turned out to be a non-empty directory, it caused this exception. When you delete / rename these directories, it clears the path where Jenkins recreates the soft link, thus resolving the problem.

3. Solve the problem

If we know where the problem lies, it is very convenient to solve the problem. First, log in to the new environment and delete the lastSuccessful and lastStable directories of all projects:

Find jobs/-type d\ (- name "lastSuccessful"-o-name "lastStable"\)-exec rm-rf {}\

After the execution is complete, the above exception will not occur when you build the project again.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report