Skip to content

Instantly share code, notes, and snippets.

@szymonsadowski3
szymonsadowski3 / intellij_move_dependencies_of_a_class.py
Created June 20, 2023 10:03
IntelliJ - Move class with all of its dependencies to a different package
# IntelliJ currently does not provide a functionality to move classes with all of their
# dependencies to a different module/package in IntelliJ.
# The following method can be used to accomplish this task
# 1. Determine the dependencies of a class that you would like to move by -- right-click -> Analyze -> Analyze dependencies.
# Select "Show transitive dependencies" and select the level of depth ("Do not travel deeper than" option).
# Make sure to choose a big enough level, so that even deeply nested dependencies are discovered
# (I recommend a depth level of more than 100)
# 2. Once IntelliJ finished discovering dependencies, take a look at the "Production Classes" section.