# AddQuarkusApp

- Module: [Aspire.Hosting.Java](/reference/api/go/aspire.hosting.java.md)
- Version: `17.0.0-preview.1.26565.2`
- Kind: `method`
- Defined on: `DistributedApplicationBuilder`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds a Quarkus application to the application model, built and launched with its own Maven or Gradle wrapper.

## Remarks

The build tool is detected when the resource starts, the application runs in Quarkus dev mode
(`quarkus:dev` or `quarkusDev`) so live coding works, and an HTTP endpoint is declared through
`QUARKUS_HTTP_PORT`, the environment variable Quarkus reads for its listening port. Everything else
behaves like `AddJavaApp`.
The dev-mode goal compiles the application itself, so Aspire does not add a separate build resource before it.
There are two exceptions. `WithOtelAgent` with a build-produced agent
cannot be loaded until a build has written it, and a debug session launches the packaged fast JAR rather
than the dev-mode wrapper, which no build has written on a clean checkout.
Quarkus Dev Services are left enabled but do not activate for anything Aspire supplies: Dev Services only
start a container when the corresponding configuration is missing, and a `WithReference` to a database
or broker provides it. That means Aspire's resources are used rather than a second set started underneath.
`QUARKUS_PROFILE` is set to `dev` in run mode. Dev mode already selects that profile; setting it
explicitly means a debugger, which launches the packaged application rather than the dev-mode wrapper,
resolves the same `%dev.` configuration the application would see when run normally.
In run mode the application is bound to all interfaces. Quarkus enables Host header validation
whenever it binds a localhost name, and that filter rejects the hostname Aspire publishes, which
makes the endpoint link in the dashboard return `400`. Published output is left alone, where
the application already binds all interfaces.
No health check is added. `/q/health` only exists when the application depends on
`quarkus-smallrye-health`, and adding it unconditionally would leave applications without that
extension permanently unhealthy and silently stall every `WaitFor` on them. Add
`WithHttpHealthCheck("/q/health")` when the extension is present.

## Definition

```go
func (DistributedApplicationBuilder) AddQuarkusApp(
    name string,
    appDirectory string,
) JavaAppResource
```

## Parameters

- `name` (`string`) -- The name of the resource.
- `appDirectory` (`string`) -- The application directory, containing `pom.xml`, `build.gradle`, `build.gradle.kts`, `settings.gradle`, or `settings.gradle.kts`. Relative paths are resolved against the AppHost directory.

## Returns

[`JavaAppResource`](/reference/api/go/aspire.hosting.java/javaappresource.md) -- A reference to the `IResourceBuilder`.

Returns a handle; failures surface later via `Err()`.

## Applies to

- `DistributedApplicationBuilder`
