Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithMainClass

Method
📦 Aspire.Hosting.Java v17.0.0-preview.1.26565.2
func (JavaAppResource) WithMainClass(mainClass string) JavaAppResource

Signature

methodWithMainClassbuilder
Sets the main class an IDE launches when running or debugging this application. Has no effect on how Aspire starts the process, which is decided by the JAR path, Maven goal, or Gradle task.
WithMainClass(mainClass string) JavaAppResource
mainClassstringThe fully qualified name of the class declaring main, for example com.example.Application.
JavaAppResource

A reference to the IResourceBuilder.

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

Applies to

This method applies to the following types: