JavaAppHostingExtension
Class static net10.0
Provides extension methods for adding Java applications to an
Hosting.IDistributedApplicationBuilder. namespace Aspire.Hosting;
public static class JavaAppHostingExtension{ // ...} 15 members
Methods15
Section titled MethodsAddJavaApp(IDistributedApplicationBuilder, string, JavaAppContainerResourceOptions)extensionobsoleteIResourceBuilder<JavaAppContainerResource> Adds a Java application to the application model. Executes the containerized Java app.
AddJavaApp(IDistributedApplicationBuilder, string, string, string, string[]?)extensionats exportIResourceBuilder<JavaAppExecutableResource> Adds a Java application to the application model. Executes the executable Java app.
AddJavaApp(IDistributedApplicationBuilder, string, string)extensionats exportIResourceBuilder<JavaAppExecutableResource> Adds a Java application to the application model. Executes the executable Java app.
AddJavaApp(IDistributedApplicationBuilder, string, string, JavaAppExecutableResourceOptions)extensionobsoleteIResourceBuilder<JavaAppExecutableResource> Adds a Java application to the application model. Executes the executable Java app.
AddJavaContainerApp(IDistributedApplicationBuilder, string, string, string?)extensionats exportIResourceBuilder<JavaAppContainerResource> Adds a Java application to the application model. Executes the containerized Java app.
AddSpringApp(IDistributedApplicationBuilder, string, JavaAppContainerResourceOptions)extensionobsoleteIResourceBuilder<JavaAppContainerResource> Adds a Spring application to the application model. Executes the containerized Spring app.
AddSpringApp(IDistributedApplicationBuilder, string, string, JavaAppExecutableResourceOptions)extensionobsoleteIResourceBuilder<JavaAppExecutableResource> Adds a Spring application to the application model. Executes the executable Spring app.
WithGradleBuild(IResourceBuilder<JavaAppExecutableResource>, string[])extensionats exportIResourceBuilder<JavaAppExecutableResource> Adds a Gradle build step to the application model. The wrapper script path defaults to
gradlew (or gradlew.bat on Windows) in the resource's working directory, unless overridden with JavaAppHostingExtension.WithWrapperPath. WithGradleTask(IResourceBuilder<JavaAppExecutableResource>, string, string[])extensionats exportIResourceBuilder<JavaAppExecutableResource> Configures the Java application to run using a Gradle task (e.g.,
bootRun). In run mode, the resource command is changed from java to the Gradle wrapper. The wrapper script path defaults to gradlew (or gradlew.bat on Windows) in the resource's working directory, unless overridden with JavaAppHostingExtension.WithWrapperPath. WithJvmArgs(IResourceBuilder<T>, string[])extensionats exportIResourceBuilder<T> Configures the Java Virtual Machine arguments for the Java application. The arguments are set via the
JAVA_TOOL_OPTIONS environment variable, which is recognized by the JVM regardless of how the application is launched (e.g., java -jar, Maven wrapper, or Gradle wrapper). WithMavenBuild(IResourceBuilder<JavaAppExecutableResource>, MavenOptions)extensionobsoleteIResourceBuilder<JavaAppExecutableResource> Adds a Maven build step to the application model.
WithMavenBuild(IResourceBuilder<JavaAppExecutableResource>, string[])extensionats exportIResourceBuilder<JavaAppExecutableResource> Adds a Maven build step to the application model. The wrapper script path defaults to
mvnw (or mvnw.cmd on Windows) in the resource's working directory, unless overridden with JavaAppHostingExtension.WithWrapperPath. WithMavenGoal(IResourceBuilder<JavaAppExecutableResource>, string, string[])extensionats exportIResourceBuilder<JavaAppExecutableResource> Configures the Java application to run using a Maven goal (e.g.,
spring-boot:run). In run mode, the resource command is changed from java to the Maven wrapper. The wrapper script path defaults to mvnw (or mvnw.cmd on Windows) in the resource's working directory, unless overridden with JavaAppHostingExtension.WithWrapperPath. WithOtelAgent(IResourceBuilder<T>, string?)extensionats exportIResourceBuilder<T> Configures the OpenTelemetry Java Agent for the Java application.
WithWrapperPath(IResourceBuilder<JavaAppExecutableResource>, string)extensionats exportIResourceBuilder<JavaAppExecutableResource> Configures a custom build tool wrapper script path. This is useful when the wrapper script is not in the default location or has a non-standard name.