Aspire.Hosting.Java
Official
📦 Aspire.Hosting.Javav17.0.0-preview.1.26565.2Import path
apphost/modules/aspire15Functions
3Types
3 types, 15 functions and 2 members
Handles
Functions
DistributedApplicationBuilder
method
AddJavaAppbuilderAdds a Java application to the application model, launched with
java.AddJavaApp(name string, appDirectory string) JavaAppResourcemethod
AddJavaAppWithJarbuilderAdds a Java application that runs a prebuilt JAR with
java -jar .AddJavaAppWithJar(name string, appDirectory string, jarPath string, args []string) JavaAppResourcemethod
AddJavaContainerbuilderAdds a Java application that runs from an existing container image.
AddJavaContainer(name string, image string, options ...*AddJavaContainerOptions) JavaContainerResourcemethod
AddQuarkusAppbuilderAdds a Quarkus application to the application model, built and launched with its own Maven or Gradle wrapper.
AddQuarkusApp(name string, appDirectory string) JavaAppResourcemethod
AddSpringBootAppbuilderAdds a Spring Boot application to the application model, built and launched with its own Maven or Gradle wrapper.
AddSpringBootApp(name string, appDirectory string) JavaAppResourceIJavaAppResource
JavaAppResource
method
WithGradleBuildbuilderRuns a Gradle build before the Java application starts.
WithGradleBuild(args []string) JavaAppResourcemethod
WithGradleTaskbuilderLaunches the Java application through a Gradle task instead of
java, for example bootRun .WithGradleTask(task string, args []string) JavaAppResourcemethod
WithJarArtifactbuilderSelects the JAR the generated container image runs, for projects whose build produces more than one.
WithJarArtifact(jarPath string) JavaAppResourcemethod
WithMainClassbuilderSets 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) JavaAppResourcemethod
WithMavenBuildbuilderRuns a Maven build before the Java application starts.
WithMavenBuild(args []string) JavaAppResourcemethod
WithMavenGoalbuilderLaunches the Java application through a Maven goal instead of
java, for example spring-boot:run .WithMavenGoal(goal string, args []string) JavaAppResourcemethod
WithOtelAgentbuilderRuns the application with the OpenTelemetry Java agent so it exports traces, metrics, and logs to Aspire.
WithOtelAgent(agentPath string) JavaAppResourcemethod
WithOtelAgentDefaultPathbuilderRuns the application with the OpenTelemetry Java agent from the location the build tool writes it to.
WithOtelAgentDefaultPath() JavaAppResourcemethod
WithWrapperPathbuilderOverrides 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