Skip to content

Maven cloud agent environment#2319

Merged
dadoonet merged 2 commits intomasterfrom
cursor/maven-cloud-agent-environment-28ae
Mar 7, 2026
Merged

Maven cloud agent environment#2319
dadoonet merged 2 commits intomasterfrom
cursor/maven-cloud-agent-environment-28ae

Conversation

@dadoonet
Copy link
Owner

@dadoonet dadoonet commented Mar 7, 2026

Add Maven to the cloud agent base environment for FSCrawler to enable running Java module tests directly.

This PR configures the cloud agent to use the maven:3-eclipse-temurin-21 base image, ensuring Maven and Java 21 (matching project CI) are available by default. An install step is included to pre-compile dependencies, speeding up subsequent test runs.


Open in Web Open in Cursor 

- Add .cursor/environment.json with maven:3-eclipse-temurin-21 base image
- mvn is available by default for module tests (e.g. mvn -pl beans -am test)
- Pre-compile step caches dependencies for faster agent startup

Co-authored-by: David Pilato <david@pilato.fr>
@cursor
Copy link

cursor bot commented Mar 7, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@dadoonet dadoonet marked this pull request as ready for review March 7, 2026 04:50
@dadoonet dadoonet requested a review from Copilot March 7, 2026 04:50
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@@ -0,0 +1,4 @@
{
"baseImage": "maven:3-eclipse-temurin-21",
"install": "mvn -B -DskipTests -DskipIntegTests compile -q"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maven compile phase insufficient for multi-module dependency resolution

Medium Severity

The install command uses the compile Maven phase, but this is a multi-module project with 15+ interdependent modules. The compile phase doesn't install module artifacts into the local Maven repository, so when the agent later attempts to run tests on an individual module (e.g., mvn test -pl core), Maven won't find sibling module JARs and the build will fail. The project's own CURSOR.md recommends mvn clean install -DskipIntegTests for this reason. Using install instead of compile as the lifecycle phase would match the project's conventions and actually fulfill the stated goal of enabling test runs.

Fix in Cursor Fix in Web

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a .cursor/environment.json file to configure the Cursor cloud agent's base environment, making Maven and Java 21 (matching the project's CI configuration) available by default. This enables running Java module tests directly within the Cursor agent environment without additional setup.

Changes:

  • Adds .cursor/environment.json with maven:3-eclipse-temurin-21 as the base image
  • Configures a pre-compilation install step (mvn -B -DskipTests -DskipIntegTests compile -q) to warm up Maven's dependency cache

@@ -0,0 +1,4 @@
{
"baseImage": "maven:3-eclipse-temurin-21",
"install": "mvn -B -DskipTests -DskipIntegTests compile -q"
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The install command runs mvn ... compile -q, which only compiles main sources (src/main/java). However, the PR description states the goal is to "enable running Java module tests directly" and "pre-compile dependencies, speeding up subsequent test runs." To achieve this, the test-compile phase should be used instead of (or in addition to) compile, since test-compile compiles both main and test sources. Without compiling test sources in the install step, subsequent test runs will still need to compile test classes from scratch, reducing the benefit of the pre-compilation step.

Suggested change
"install": "mvn -B -DskipTests -DskipIntegTests compile -q"
"install": "mvn -B -DskipTests -DskipIntegTests test-compile -q"

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,4 @@
{
"baseImage": "maven:3-eclipse-temurin-21",
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The maven:3-eclipse-temurin-21 base image uses a floating/mutable tag. This means the resolved Maven version can change between environment builds as Docker Hub updates the tag (e.g., a new minor or patch Maven release). For reproducibility, consider pinning to a more specific tag such as maven:3.9-eclipse-temurin-21 to lock the Maven major/minor version, or even a fully versioned tag like maven:3.9.9-eclipse-temurin-21.

Suggested change
"baseImage": "maven:3-eclipse-temurin-21",
"baseImage": "maven:3.9.9-eclipse-temurin-21",

Copilot uses AI. Check for mistakes.
The compile phase doesn't install module artifacts to the local Maven
repository. For this 16-module project with interdependencies, running
tests on individual modules (e.g., mvn test -pl core) fails without
sibling JARs installed. Matches CURSOR.md recommendation.

Co-authored-by: David Pilato <david@pilato.fr>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 7, 2026

@dadoonet dadoonet merged commit ca30304 into master Mar 7, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants