# WithMavenGoal

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

Launches the Java application through a Maven goal instead of `java`, for example `spring-boot:run`.

## Remarks

The wrapper defaults to `mvnw` (`mvnw.cmd` on Windows) in the resource's working directory
and can be overridden with `WithWrapperPath`.

## Definition

```go
func (JavaAppResource) WithMavenGoal(
    goal string,
    args []string,
) JavaAppResource
```

## Parameters

- `goal` (`string`) -- The Maven goal to execute.
- `args` (`[]string`) -- Additional arguments passed to the Maven wrapper after the goal.

## 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

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