CommunityToolkit.Aspire.Hosting.Java 13.2.1-beta.531

Prefix Reserved
This is a prerelease version of CommunityToolkit.Aspire.Hosting.Java.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CommunityToolkit.Aspire.Hosting.Java --version 13.2.1-beta.531
                    
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Java -Version 13.2.1-beta.531
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Java" Version="13.2.1-beta.531" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Java" Version="13.2.1-beta.531" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Java" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommunityToolkit.Aspire.Hosting.Java --version 13.2.1-beta.531
                    
#r "nuget: CommunityToolkit.Aspire.Hosting.Java, 13.2.1-beta.531"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommunityToolkit.Aspire.Hosting.Java@13.2.1-beta.531
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommunityToolkit.Aspire.Hosting.Java&version=13.2.1-beta.531&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Java&version=13.2.1-beta.531&prerelease
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.532 37 3/13/2026
13.2.1-beta.531 44 3/11/2026
13.2.1-beta.528 40 3/5/2026
13.1.2-beta.518 56 2/17/2026
13.1.2-beta.516 54 2/9/2026
13.1.2-beta.515 53 2/2/2026
13.1.2-beta.514 50 1/30/2026
13.1.2-beta.513 51 1/29/2026
13.1.2-beta.512 53 1/29/2026
13.1.2-beta.511 53 1/28/2026
13.1.2-beta.509 51 1/20/2026
13.1.2-beta.508 52 1/19/2026
13.1.2-beta.507 52 1/19/2026
13.1.2-beta.506 53 1/16/2026
13.1.2-beta.505 56 1/16/2026
13.1.2-beta.504 54 1/16/2026
13.1.1 322 1/16/2026
13.1.1-beta.502 56 1/16/2026
13.1.0 109 1/14/2026
13.1.0-beta.499 52 1/14/2026
Loading failed