# JavaAppResource.withGradleTask

- Module: [Aspire.Hosting.Java](/reference/api/typescript/aspire.hosting.java.md)
- Defined on: [JavaAppResource](/reference/api/typescript/aspire.hosting.java/javaappresource.md)
- Version: `13.6.0-preview.1.26478.8`
- Kind: `method`

Launches the Java application through a Gradle task instead of `java`, for example `bootRun`.

## Definition

```typescript
interface JavaAppResource {
  // ... omitted for brevity
  withGradleTask(
      task: string,
      args: string[]): JavaAppResource;
}
```

## Signature

```typescript
withGradleTask(
    task: string,
    args: string[]): JavaAppResource
```

## Parameters

- `task` (`string`)
- `args` (`string[]`)

## Returns

[JavaAppResource](/reference/api/typescript/aspire.hosting.java/javaappresource.md) `builder`

## Defined on

- [JavaAppResource](/reference/api/typescript/aspire.hosting.java/javaappresource.md) -- `handle`
