# JavaAppResource.WithMavenGoal

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

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
type JavaAppResource interface {
    // ... omitted for brevity
    WithMavenGoal(
        goal string,
        args []string,
    ) JavaAppResource
}
```

## Signature

```go
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()`.

## Defined on

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