@@ -176,17 +176,25 @@ public BazelJvmClasspathResponse getClasspathEntries() {
176176
177177 for (AspectTargetInfo targetInfo : targetInfos ) {
178178 if (actualActivatedTargets .contains (targetInfo .getLabel ())) {
179- // this info describes a target in the current package, don't add it to the classpath
180- // as this classpath strategy does not include them as all targets in this package are
181- // assumed to be represented by source code entries instead
182- continue ;
179+ if ("java_library" .equals (targetInfo .getKind ())) {
180+ // this info describes a java_library target in the current package; don't add it to the classpath
181+ // as all java_library targets in this package are assumed to be represented by source code entries
182+ continue ;
183+ }
184+ // else in some cases, the target is local, but we still want to proceed to process it below. the expected
185+ // example here are java_import targets in the BUILD file that directly load jars from the file system
186+ // java_import(name = "zip4j", jars = ["lib/zip4j-2.6.4.jar"])
187+ if (!"java_import" .equals (targetInfo .getKind ())) {
188+ // some other case that we didn't expect, proceed but log a warn
189+ logger .warn ("Unexpected local target type as dependency: " + targetInfo .getKind () + "; expected either java_library or java_import." );
190+ }
183191 }
184192
185193 BazelProject otherProject = getSourceProjectForSourcePaths (targetInfo .getSources ());
186-
187194 if (otherProject == null ) {
188195 // no project found that houses the sources of this bazel target, add the jars to the classpath
189196 // this means that this is an external jar, or a jar produced by a bazel target that was not imported
197+
190198 for (AspectOutputJarSet jarSet : targetInfo .getGeneratedJars ()) {
191199 JvmClasspathEntry cpEntry = jarsToClasspathEntry (jarSet , isTestTarget );
192200 if (cpEntry != null ) {
0 commit comments