Skip to content

fix: align Maven profiles with Spring profiles for all AI providers#2

Merged
anyulled merged 1 commit intosolutionfrom
feature/align-maven-profiles-with-spring-boot-profiles-for-all-ai-providers
Feb 27, 2026
Merged

fix: align Maven profiles with Spring profiles for all AI providers#2
anyulled merged 1 commit intosolutionfrom
feature/align-maven-profiles-with-spring-boot-profiles-for-all-ai-providers

Conversation

@icougil
Copy link
Member

@icougil icougil commented Feb 27, 2026

Now we can run the app only with the maven profiles only ;-)

…we can run the app only with the maven profiles only)
Copy link

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 aligns Maven profile selection with Spring profile activation for each supported AI provider, aiming to let users run the app by choosing only a Maven profile.

Changes:

  • Updated application.yml to use per-provider spring.config.activate.on-profile blocks (openai, vertex-ai, ollama, anthropic) and added a github-copilot profile.
  • Updated pom.xml Maven profiles to set spring-boot.run.profiles for each provider and added a github-copilot Maven profile.
  • Updated README.md provider/config documentation and run commands to use -P<profile>.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/main/resources/application.yml Adds per-Spring-profile AI provider configuration blocks and a shared arena base URL.
pom.xml Sets Spring runtime profiles from Maven profiles and introduces a new github-copilot provider profile.
README.md Updates provider matrix and run instructions to reflect Maven-profile-driven execution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -74,9 +74,9 @@
<profiles>
<profile>
<id>openai</id>
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

With no Spring AI dependency declared outside Maven profiles, removing activeByDefault from the openai profile means a default mvn test/IDE import will fail to compile (main sources import org.springframework.ai.*). Consider restoring activeByDefault for openai (and keep spring-boot.run.profiles), or add a non-profile Spring AI core dependency so builds don’t require -P....

Suggested change
<id>openai</id>
<id>openai</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

@copilot the mvn test still works...

Comment on lines 15 to 19
openai:
api-key: ${OPENAI_API_KEY}
api-key: ${OPENAI_API_KEY:your-openai-key-here}
chat:
options:
model: gpt-4o-mini
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

spring.ai.*.api-key defaults to a placeholder value when the env var is missing, which can mask misconfiguration (app starts but auth fails later). Prefer omitting defaults for secret credentials and failing fast (or add explicit validation).

Copilot uses AI. Check for mistakes.
Comment on lines 54 to 58
anthropic:
api-key: ${ANTHROPIC_API_KEY:your-anthropic-key-here}
chat:
options:
model: claude-3-5-haiku-20241022
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

spring.ai.*.api-key defaults to a placeholder value when the env var is missing, which can mask misconfiguration (app starts but auth fails later). Prefer omitting defaults for secret credentials and failing fast (or add explicit validation).

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +70
openai:
api-key: ${GITHUB_TOKEN:your-github-token-here}
base-url: https://models.inference.ai.azure.com
chat:
completions-path: /chat/completions
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

spring.ai.*.api-key defaults to a placeholder value when the env var is missing, which can mask misconfiguration (app starts but auth fails later). Prefer omitting defaults for secret credentials and failing fast (or add explicit validation).

Copilot uses AI. Check for mistakes.
Comment on lines +92 to 96
Use the Maven wrapper to run the project with the desired profile:

```bash
# Run with OpenAI (default profile)
./mvnw spring-boot:run

# Or run with a specific profile
./mvnw spring-boot:run -Popenai
./mvnw spring-boot:run -Pvertex-ai
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Because Spring AI dependencies are only included via Maven profiles, running Maven goals without -P... (e.g., ./mvnw clean test as shown earlier in the README) will fail to compile. Either restore a default profile (e.g., OpenAI) or update the setup docs around these run commands to note that users must pass a provider profile for builds/tests too.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

@copilot code review[agent] I think you're wrong , I executed the mvn clean test goal and still it is working...

Copy link
Contributor

Copilot AI commented Feb 27, 2026

@icougil I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 27, 2026

@icougil I've opened a new pull request, #6, to work on those changes. Once the pull request is ready, I'll request review from you.

@anyulled anyulled merged commit c33f8c0 into solution Feb 27, 2026
5 checks passed
@icougil icougil deleted the feature/align-maven-profiles-with-spring-boot-profiles-for-all-ai-providers branch February 28, 2026 16:16
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.

4 participants