apache / apache/maven-compiler-plugin

[MCOMPILER-312] Maven annotation processor compiler error after changing the code

Open
#509 1 comment 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
261
Forks
191
Avg merge
1d 5h
Merged PRs (30d)
8

Description

**[Filipe Sousa](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=natros)** opened **[MCOMPILER-312](https://issues.apache.org/jira/browse/MCOMPILER-312?redirect=false)** and commented

Hi,

I've been using google dagger annotation processor with maven. Is this project (https://github.com/natros/dagger2-mcp-test) when I make a change I have to clean install otherwise I'm getting compiler errors.

Steps to reproduce:

first time compile, compiles ok

```
./mvnw clean compile
```

changing the code

```
sed -i -e 's@AuthService@//AuthService@' src/main/java/com/github/natros/mcp/Main.java
```

compile without clean and fail

```
./mvnw compile
```

clean compile and no errors

```
./mvnw clean compile
```

On a large project it does not makes sense to clean before compiling.

This is the error I'm getting:

```
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/fsousa/Projects/tmp/dagger2-mcp-test/target/generated-sources/annotations/com/github/natros/mcp/DaggerMyComponent.java:[30,37] method create in class com.github.natros.mcp.Main_Factory cannot be applied to given types;
required: javax.inject.Provider,javax.inject.Provider
found: dagger.internal.Factory
reason: actual and formal argument lists differ in length
[ERROR] /Users/fsousa/Projects/tmp/dagger2-mcp-test/target/generated-sources/annotations/com/github/natros/mcp/Main_Factory.java:[26,12] constructor Main in class com.github.natros.mcp.Main cannot be applied to given types;
required: com.github.natros.mcp.UserService
found: com.github.natros.mcp.AuthService,com.github.natros.mcp.UserService
reason: actual and formal argument lists differ in length
[INFO] 2 errors
```

I asked this question to dagger creators who told me that this is a maven bug not a dagger one.
https://github.com/google/dagger/issues/881#issuecomment-335854660

---

**Affects:** 3.7.0

**Attachments:**
- [incremental_generate.patch](https://issues.apache.org/jira/secure/attachment/12914434/incremental_generate.patch) (_4.47 kB_)

**Issue Links:**
- [MCOMPILER-300](https://issues.apache.org/jira/browse/MCOMPILER-300) Maven compiler plugin 3.X.X recompiling generated sources and failing with compilation error
(_**"Blocked"**_)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure in the linked dagger2-mcp-test project with the listed clean and incremental Maven commands. Inspect the generated sources under target/generated-sources/annotations and compare the behavior with incremental_generate.patch and the linked MCOMPILER-300 issue; done means recompiling after the source change succeeds without cleaning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.