CommunityToolkit.Aspire.Hosting.Java 13.4.1-beta.687

Prefix Reserved
This is a prerelease version of CommunityToolkit.Aspire.Hosting.Java.
There is a newer version of this package available.
See the version list below for details.
dotnet add package CommunityToolkit.Aspire.Hosting.Java --version 13.4.1-beta.687
                    
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Java -Version 13.4.1-beta.687
                    
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.4.1-beta.687" />
                    
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.4.1-beta.687" />
                    
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.4.1-beta.687
                    
#r "nuget: CommunityToolkit.Aspire.Hosting.Java, 13.4.1-beta.687"
                    
#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.4.1-beta.687
                    
#: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.4.1-beta.687&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Java&version=13.4.1-beta.687&prerelease
                    
Install as a Cake Tool

CommunityToolkit.Aspire.Hosting.Java

Provides extension methods and resource definitions for the 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 (1)

Showing the top 1 NuGet packages that depend on CommunityToolkit.Aspire.Hosting.Java:

Package Downloads
KoalaSoft.Aspire.Hosting.ServiceSources.Java

Java support for KoalaSoft.Aspire.Hosting.ServiceSources — lets an AddService() "local" source clone and run a Java service (Maven goal, Gradle task, or a jar) via the .NET Aspire Community Toolkit's Java integration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
13.5.0 65 8/25/2026
13.5.0-beta.731 57 8/24/2026
13.5.0-beta.730 58 8/21/2026
13.4.1-beta.706 62 8/6/2026
13.4.1-beta.704 56 8/5/2026
13.4.1-beta.701 56 8/4/2026
13.4.1-beta.700 55 8/2/2026
13.4.1-beta.696 60 8/1/2026
13.4.1-beta.687 338 7/27/2026
13.4.1-beta.686 612 7/16/2026
13.4.1-beta.685 73 7/9/2026
13.4.1-beta.683 70 7/9/2026
13.4.1-beta.680 62 7/7/2026
13.4.1-beta.676 71 7/7/2026
13.4.1-beta.675 60 7/6/2026
13.4.1-beta.674 66 7/6/2026
13.4.0 889 6/2/2026
13.4.0-beta.671 62 7/3/2026
13.4.0-beta.654 77 6/18/2026
13.4.0-beta.651 72 6/17/2026
Loading failed