quarkusio/quarkus · error · BuildException
No Google Cloud Function found on the classpath
Error message
No Google Cloud Function found on the classpath
What it means
At build time the processor scans the application index for classes annotated as Google Cloud Functions (HTTP, CloudEvent, background). If none are found, the build fails with this BuildException, because a GCF project must contain at least one function.
Source
Thrown at extensions/google-cloud-functions/deployment/src/main/java/io/quarkus/gcp/functions/deployment/GoogleCloudFunctionsProcessor.java:75
IndexView index = combinedIndex.getIndex();
Collection<ClassInfo> httpFunctions = index.getAllKnownImplementors(DOTNAME_HTTP_FUNCTION);
Collection<ClassInfo> backgroundFunctions = index.getAllKnownImplementors(DOTNAME_BACKGROUND_FUNCTION);
Collection<ClassInfo> rawBackgroundFunctions = index.getAllKnownImplementors(DOTNAME_RAW_BACKGROUND_FUNCTION);
Collection<ClassInfo> cloudEventFunctions = index.getAllKnownImplementors(DOTNAME_CLOUD_EVENT_FUNCTION);
List<CloudFunctionBuildItem> cloudFunctions = new ArrayList<>();
cloudFunctions.addAll(
registerFunctions(unremovableBeans, httpFunctions, GoogleCloudFunctionInfo.FunctionType.HTTP));
cloudFunctions.addAll(
registerFunctions(unremovableBeans, backgroundFunctions, GoogleCloudFunctionInfo.FunctionType.BACKGROUND));
cloudFunctions.addAll(
registerFunctions(unremovableBeans, rawBackgroundFunctions,
GoogleCloudFunctionInfo.FunctionType.RAW_BACKGROUND));
cloudFunctions.addAll(
registerFunctions(unremovableBeans, cloudEventFunctions, GoogleCloudFunctionInfo.FunctionType.CLOUD_EVENT));
if (cloudFunctions.isEmpty()) {
throw new BuildException("No Google Cloud Function found on the classpath", Collections.emptyList());
}
return cloudFunctions;
}
private List<CloudFunctionBuildItem> registerFunctions(BuildProducer<UnremovableBeanBuildItem> unremovableBeans,
Collection<ClassInfo> functions,
GoogleCloudFunctionInfo.FunctionType functionType) {
List<CloudFunctionBuildItem> buildItems = new ArrayList<>();
for (ClassInfo classInfo : functions) {
String className = classInfo.name().toString();
unremovableBeans.produce(UnremovableBeanBuildItem.beanClassNames(className));
List<AnnotationInstance> annotationInstances = classInfo.annotationsMap().get(DOTNAME_NAMED);
CloudFunctionBuildItem buildItem = new CloudFunctionBuildItem(className, functionType);
if (annotationInstances != null) {
buildItem.setBeanName(annotationInstances.get(0).value().asString());
}
buildItems.add(buildItem);
}View on GitHub (pinned to e1c734241f)
Solutions
- Add a class implementing/delegating a GCF function annotated with @GoogleCloudFunction to your application.
- Verify you are using the quarkus-google-cloud-functions extension, not raw Google libraries.
- Check that the function class is in your application's own sources (indexed) rather than only in a dependency.
- Confirm the annotation is correct (e.g. com.google.cloud.functions invoker annotations / Quarkus GCF annotations) and not accidentally removed by a refactor.
Example fix
// before
public class MyFunction { /* no function */ }
// after
@Named("fn")
public class MyFunction implements CloudEventsFunction {
public void accept(CloudEvent event) { /* ... */ }
} Defensive patterns
Strategy: validation
Validate before calling
// Check at least one function annotation exists before building
grep -rl '@GoogleCloudFunction\|CloudEventsFunction\|BackgroundFunction' src/main/java || \
{ echo 'No Google Cloud Function found'; exit 1; } Prevention
- Keep at least one @GoogleCloudFunction-annotated class in src/main/java
- Use the Quarkus GCF quickstart as the template
- Do not remove example functions from scaffolded projects without adding one
- Verify the quarkus-google-cloud-functions extension dependency is present
When it happens
Trigger: Building a project that depends on the Google Cloud Functions extension but has no class annotated with @GoogleCloudFunction (or equivalent function interfaces/annotations).
Common situations: Scaffolded project where the example function was deleted; annotation on a class outside the indexed application sources (e.g. only in a library not indexed as application class); wrong dependency added (plain gcp libraries instead of quarkus-google-cloud-functions).
Related errors
- Google Cloud Function deployment need to use a uberjar, plea
- The Google Cloud extensions are incompatible with the 'nativ
- Google Cloud Function deployment need to use a uberjar, plea
- Failed to open path tree with root %s
- Dev services for ${request.getName()} requires a startable s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/fdb39615df4194d5.
Report an issue: GitHub.