Boost Java Productivity: Integrate Claude & Codex into IntelliJ IDEA Free

The article presents a step‑by‑step, three‑month‑tested workflow that embeds Anthropic Claude and OpenAI Codex into IntelliJ IDEA via the Continue plugin, enabling Java developers to auto‑generate CRUD code, unit tests, and refactorings, connect Claude to the database, and avoid repetitive coding tasks without purchasing a subscription.

Java Web Project
Java Web Project
Java Web Project
Boost Java Productivity: Integrate Claude & Codex into IntelliJ IDEA Free

This solution’s impact on Java development

Before diving into configuration, the author states the main outcomes: CRUD code generation drops from a few hours to twenty minutes, code review becomes a concrete dialogue with Claude, unit tests are generated automatically, and refactoring is guided by AI. The core idea is to outsource repetitive boilerplate to AI while keeping architectural decisions in the developer’s hands.

Identifying the real problem

Typical AI‑assisted coding involves copying code snippets into ChatGPT or using Copilot without project context, which leads to fragmented assistance. The author argues that the real issue is that AI does not live inside the project—it cannot see the database schema, utility classes, or exception‑handling conventions, so each interaction requires re‑explaining the context.

Why combine Claude and Codex

Claude is a comprehension model that excels at reasoning over large contexts, identifying coupling, concurrency risks, and impact of changes, but its completion latency is higher. Codex is a generation model optimized for code completion with very low latency, yet it lacks deep semantic understanding. By pairing Claude (for thinking) with Codex (for writing), the workflow gets the best of both worlds.

Installing the Continue plugin in IDEA

Search for Continue in Settings → Plugins, install, and restart IDEA. After restart, a Continue icon appears in the right‑hand sidebar.

Open the plugin’s configuration file at ~/.continue/config.json and add the following model definitions:

{
  "models": [
    {
      "title": "Claude Sonnet 4",
      "provider": "openai",
      "model": "claude-sonnet-4-20250514",
      "apiKey": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "apiBase": "https://api.openai-proxy.org/v1"
    }
  ],
  "tabAutocompleteModel": {
    "title": "Claude Haiku",
    "provider": "openai",
    "model": "claude-haiku-4-5-20251001",
    "apiKey": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "apiBase": "https://api.openai-proxy.org/v1"
  }
}

Claude Sonnet 4 handles the main dialogue (strong comprehension) while Haiku provides cheap, fast completions.

Providing project context for Claude

Create .continue/context.md at the project root with concise project background, technology stack, and coding conventions. Example excerpt:

## 项目背景
B2B 采购平台后端,服务约 200 家企业客户,日均订单约 3 万笔。

## 技术栈
- Java 17 + Spring Boot 3.2
- MyBatis-Plus 3.5,禁止写原生 SQL,统一走 LambdaQueryWrapper
- MySQL 8.0 主从分离,AbstractRoutingDataSource 实现读写分离
- Redis 7.0,分布式锁用 Redisson,缓存用 @Cacheable 注解
- RocketMQ 5.0,订单超时、库存扣减走消息队列

## 编码规范
- 统一返回 Result<T>,禁止直接返回 POJO
- 业务异常继承 BizException,由 GlobalExceptionHandler 统一处理
- 金额字段统一用 BigDecimal,禁止 float/double
- ID 用 IdGenerator 雪花算法生成,禁止数据库自增

The author notes that overly long context files (>200 lines) degrade Claude’s performance; only essential conventions should be included.

Enabling Model Context Protocol (MCP) for database access

Add an mcpServers entry to config.json so Claude can query the MySQL schema directly:

{
  "mcpServers": [
    {
      "name": "mysql",
      "command": "npx",
      "args": ["-y", "@benborla29/mcp-server-mysql"],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASS": "yourpassword",
        "MYSQL_DB": "your_db_name"
      }
    }
  ]
}

After restarting IDEA, a database icon appears in the Continue dialog, allowing commands such as “generate Entity and ServiceImpl for the purchase_order table”.

Connecting Codex

If the organization already has GitHub Copilot, enable it via the plugin settings; Copilot now runs on the Codex‑enhanced model (2025 upgrade). Otherwise, add a Codex entry to the models array in config.json:

{
  "title": "OpenAI Codex",
  "provider": "openai",
  "model": "gpt-4o",
  "apiKey": "sk-...",
  "apiBase": "https://api.openai-proxy.org/v1"
}

Typical daily workflow

1. Paste a feature requirement into the Continue panel and ask Claude: “Based on our project structure, which tables and interfaces are needed for a bulk supplier‑quote feature?” Claude, using context.md, suggests creating supplier_quote and supplier_quote_item tables and reusing the existing purchase_order layering. 2. While writing business logic, Codex provides real‑time completions; a single comment triggers full method implementation. 3. After the core method is written, select the code and press Cmd + L to send it to Claude, which generates a JUnit 5 + Mockito test suite adhering to the project’s conventions. Real pitfalls encountered Haiku sometimes violates project conventions. Explicitly list prohibitions (e.g., “never use float/double for money”) in context.md or switch the autocomplete model back to Sonnet. MCP command not found on Windows. Replace the generic npx command with an absolute path, e.g., "C:\Program Files\nodejs\npx.cmd" . Too large context.md . When the file exceeds ~200 lines, Claude loses focus; keep only schema, stack, and rule sections. Final thoughts The author spent roughly two afternoons on initial configuration and has used the setup continuously since. While AI cannot replace high‑level architectural decisions, it reliably handles repetitive tasks—CRUD scaffolding, unit test generation, documentation, and commit messages—saving an estimated 30‑40 % of a backend engineer’s routine time.

JavaAI-assisted developmentMCPIntelliJ IDEAClaudeCodexContinue plugin
Java Web Project
Written by

Java Web Project

Focused on Java backend technologies, trending internet tech, and the latest industry developments. The platform serves over 200,000 Java developers, inviting you to learn and exchange ideas together. Check the menu for Java learning resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.