CommunityToolkit.Aspire.Hosting.Java
13.2.1-beta.528
Prefix Reserved
dotnet add package CommunityToolkit.Aspire.Hosting.Java --version 13.2.1-beta.528
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Java -Version 13.2.1-beta.528
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Java" Version="13.2.1-beta.528" />
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Java" Version="13.2.1-beta.528" />
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Java" />
paket add CommunityToolkit.Aspire.Hosting.Java --version 13.2.1-beta.528
#r "nuget: CommunityToolkit.Aspire.Hosting.Java, 13.2.1-beta.528"
#:package CommunityToolkit.Aspire.Hosting.Java@13.2.1-beta.528
#addin nuget:?package=CommunityToolkit.Aspire.Hosting.Java&version=13.2.1-beta.528&prerelease
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Java&version=13.2.1-beta.528&prerelease
CommunityToolkit.Aspire.Hosting.Java
Provides extension methods and resource definitions for the .NET Aspire AppHost to support running Java applications. The integration supports Maven, Gradle, and standalone JAR-based applications.
Install the package
In your AppHost project, install the package:
dotnet add package CommunityToolkit.Aspire.Hosting.Java
Add a Java application resource
Run with Maven
Use WithMavenGoal to run the application using a Maven goal:
var app = builder.AddJavaApp("app", "../java-project")
.WithMavenGoal("spring-boot:run")
.WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");
Pass additional arguments:
var app = builder.AddJavaApp("app", "../java-project")
.WithMavenGoal("spring-boot:run", "-Dspring-boot.run.profiles=dev")
.WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");
Run with Gradle
Use WithGradleTask to run the application using a Gradle task:
var app = builder.AddJavaApp("app", "../java-project")
.WithGradleTask("bootRun")
.WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");
Run with a JAR file
To run an existing JAR file, pass the jarPath parameter:
var app = builder.AddJavaApp("app", "../java-project", "target/app.jar")
.WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");
Build before run
Use WithMavenBuild or WithGradleBuild to compile the application before it starts. This is typically not needed when using WithMavenGoal or WithGradleTask, as those goals usually handle building automatically.
var app = builder.AddJavaApp("app", "../java-project", "target/app.jar")
.WithMavenBuild()
.WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");
Add a containerized Java application
To run a Java application from a container image, use AddJavaContainerApp:
var app = builder.AddJavaContainerApp("app", "my-java-image", "latest")
.WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");
JVM configuration
JVM arguments
Use WithJvmArgs to configure JVM arguments:
var app = builder.AddJavaApp("app", "../java-project")
.WithMavenGoal("spring-boot:run")
.WithJvmArgs(["-Xmx512m", "-Xms256m"])
.WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");
OpenTelemetry agent
Use WithOtelAgent to configure the OpenTelemetry Java Agent:
var app = builder.AddJavaApp("app", "../java-project", "target/app.jar")
.WithOtelAgent("../agents/opentelemetry-javaagent.jar")
.WithHttpEndpoint(targetPort: 8080, env: "SERVER_PORT");
Additional information
Feedback and contributing
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Aspire.Hosting (>= 13.2.0-preview.1.26152.2)
-
net8.0
- Aspire.Hosting (>= 13.2.0-preview.1.26152.2)
-
net9.0
- Aspire.Hosting (>= 13.2.0-preview.1.26152.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 13.2.1-beta.528 | 0 | 3/5/2026 |
| 13.1.2-beta.518 | 54 | 2/17/2026 |
| 13.1.2-beta.516 | 51 | 2/9/2026 |
| 13.1.2-beta.515 | 50 | 2/2/2026 |
| 13.1.2-beta.514 | 49 | 1/30/2026 |
| 13.1.2-beta.513 | 50 | 1/29/2026 |
| 13.1.2-beta.512 | 52 | 1/29/2026 |
| 13.1.2-beta.511 | 52 | 1/28/2026 |
| 13.1.2-beta.509 | 49 | 1/20/2026 |
| 13.1.2-beta.508 | 50 | 1/19/2026 |
| 13.1.2-beta.507 | 50 | 1/19/2026 |
| 13.1.2-beta.506 | 52 | 1/16/2026 |
| 13.1.2-beta.505 | 55 | 1/16/2026 |
| 13.1.2-beta.504 | 53 | 1/16/2026 |
| 13.1.1 | 267 | 1/16/2026 |
| 13.1.1-beta.502 | 54 | 1/16/2026 |
| 13.1.0 | 106 | 1/14/2026 |
| 13.1.0-beta.499 | 51 | 1/14/2026 |
| 13.0.1-beta.498 | 54 | 1/14/2026 |
| 13.0.1-beta.486 | 50 | 1/12/2026 |