Watch Aspire live streamsDocsTry Aspire
Watch Aspire live streamsDocsTry

JavaAppResource

Handle
📦 Aspire.Hosting.Java v13.6.0-preview.1.26478.8
interface JavaAppResource
extends IComputeResource,
IContainerFilesDestinationResource,
IResource,
IResourceWithArgs,
IResourceWithEndpoints,
IResourceWithEnvironment,
IResourceWithProbes,
IResourceWithWaitSupport,
IResourceWithServiceDiscovery,
IJavaAppResource {
withGradleBuild(args: string[]): JavaAppResource;
withGradleTask(
task: string,
args: string[]): JavaAppResource;
withJarArtifact(jarPath: string): JavaAppResource;
withMainClass(mainClass: string): JavaAppResource;
withMavenBuild(args: string[]): JavaAppResource;
withMavenGoal(
goal: string,
args: string[]): JavaAppResource;
withOtelAgent(agentPath: string): JavaAppResource;
withOtelAgentDefaultPath(): JavaAppResource;
withWrapperPath(wrapperPath: string): JavaAppResource;
}

Methods

methodwithGradleBuildbuilder
Runs a Gradle build before the Java application starts.
withGradleBuild(args: string[]): JavaAppResource
argsstring[]
JavaAppResource
methodwithGradleTaskbuilder
Launches the Java application through a Gradle task instead of `java`, for example `bootRun`.
withGradleTask(
task: string,
args: string[]): JavaAppResource
taskstring
argsstring[]
JavaAppResource
methodwithJarArtifactbuilder
Selects the JAR the generated container image runs, for projects whose build produces more than one.
withJarArtifact(jarPath: string): JavaAppResource
jarPathstring
JavaAppResource
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
mainClassstring
JavaAppResource
methodwithMavenBuildbuilder
Runs a Maven build before the Java application starts.
withMavenBuild(args: string[]): JavaAppResource
argsstring[]
JavaAppResource
methodwithMavenGoalbuilder
Launches the Java application through a Maven goal instead of `java`, for example `spring-boot:run`.
withMavenGoal(
goal: string,
args: string[]): JavaAppResource
goalstring
argsstring[]
JavaAppResource
methodwithOtelAgentbuilder
Runs the application with the OpenTelemetry Java agent so it exports traces, metrics, and logs to Aspire.
withOtelAgent(agentPath: string): JavaAppResource
agentPathstring
JavaAppResource
Runs the application with the OpenTelemetry Java agent from the location the build tool writes it to.
withOtelAgentDefaultPath(): JavaAppResource
JavaAppResource
methodwithWrapperPathbuilder
Overrides the build tool wrapper script path, for repositories whose wrapper is not in the default location or does not use the default name.
withWrapperPath(wrapperPath: string): JavaAppResource
wrapperPathstring
JavaAppResource