Abstract:Java has emerged as a leading programming language for contemporary application development, attributed to its extensive ecosystem of dependencies and user-friendly build tools such as Maven and Gradle. However, the burgeoning scale of dependencies has led to increased complexity in managing them within Java projects, often surpassing the capabilities of current tools. This complexity can lead to unforeseen issues that significantly hinder the project's builds and runtime, manifesting as build failures, crashes, semantic errors, and other adverse outcomes. This paper aims to address the gaps in the analysis of dependency management issues found in existing research and technical literature by introducing the concept of “Dependency Smell”, with the goal of establishing a unified model for these challenges. We conduct a comprehensive empirical study on dependency management issues, covering all categories of Maven and Gradle related problems. This study analyzes diverse dependency management issues gathered from open-source communities (e.g., GitHub), official documentation (e.g., Maven manual), as well as various surveys and technical papers. Ultimately, we categorize 13 subcategories of dependency smells, elucidating their triggering factors and impact characteristics. Leveraging these empirical findings, we devise a unified detection algorithm for dependency smells in Java projects and develop a specialized detection tool, JDepAna, which seamlessly integrates with Maven and Gradle build tools. Experimental results demonstrate that JDepAna achieves a detection recall rate of 95.9% for known dependency smells. Across more than a hundred new Java projects, JDepAna identifies 30,689 instances of dependency smells, with 360 instances selected for manual verification, resulting in a precision rate of 96.1%. Additionally, we report 48 instances to developers, with 42 instances promptly confirmed and 21 promptly fixed, thereby validating the e?icacy and practicality of our Java dependency smell detection algorithm and tool in facilitating quality assurance for Java projects.