diff --git a/src/python/pants/backend/jvm/subsystems/dependency_context.py b/src/python/pants/backend/jvm/subsystems/dependency_context.py index f99051ae8c4..fe3793949cf 100644 --- a/src/python/pants/backend/jvm/subsystems/dependency_context.py +++ b/src/python/pants/backend/jvm/subsystems/dependency_context.py @@ -10,6 +10,7 @@ from pants.backend.jvm.targets.javac_plugin import JavacPlugin from pants.backend.jvm.targets.scalac_plugin import ScalacPlugin from pants.base.fingerprint_strategy import FingerprintStrategy +from pants.base.hash_utils import stable_json_sha1 from pants.build_graph.dependency_context import DependencyContext as DependencyContextBase from pants.build_graph.resources import Resources from pants.build_graph.target_scopes import Scopes @@ -86,6 +87,8 @@ def compute_fingerprint(self, target): hasher = hashlib.sha1() hasher.update(target.payload.fingerprint().encode()) + # Adding tags into cache key because it may decide which workflow applies to the target. + hasher.update(stable_json_sha1(target.tags).encode()) if isinstance(target, JarLibrary): # NB: Collects only the jars for the current jar_library, and hashes them to ensure that both # the resolved coordinates, and the requested coordinates are used. This ensures that if a