David Kubecka
01/02/2023, 3:01 PMmaven-compiler-plugin
I get the same error during manual maven compilation ("package does not exist") as I get in IDEA when the pom is set up correctly.
Can anyone shed more light into this issue?Aleksei Cherepanov
01/02/2023, 3:59 PMSource folders
David Kubecka
01/02/2023, 4:03 PMAleksei Cherepanov
01/02/2023, 4:03 PMcom
folder, compiler will not find it -
so you project tree should be like:
.
└── target
├── generated-sources
│ ├── kapt
│ │ ├── com
│ │ │ └── example
│ │ │ └── blazedemo
│ │ │ └── views
│ │ │ ├── AnimalViewBuilder.java
│ │ │ ├── ...
Aleksei Cherepanov
01/02/2023, 4:05 PMtarget/generated-sources/kapt
is source root, and it will be the starting point for the compiler to look for packagesDavid Kubecka
01/02/2023, 4:07 PMDavid Kubecka
01/02/2023, 4:11 PMDavid Kubecka
01/02/2023, 4:16 PM[WARNING] Duplicate source root: /target/generated-sources/kapt/compile
I have this in the pom:
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
<sourceDir>target/generated-sources/kapt/compile</sourceDir>
</sourceDirs>
</configuration>
</execution>
Aleksei Cherepanov
01/02/2023, 4:40 PMAleksei Cherepanov
01/02/2023, 4:40 PMDavid Kubecka
01/02/2023, 4:42 PMwarning fails the buildI have it the compiler set to fail on warning.
David Kubecka
01/02/2023, 4:43 PMmvn compile
)Aleksei Cherepanov
01/02/2023, 4:56 PMDavid Kubecka
01/02/2023, 5:07 PMDavid Kubecka
01/02/2023, 5:08 PMtarget/generated-sources/kapt/compile
which satisfies IDEA but breaks mvn compile
Aleksei Cherepanov
01/02/2023, 5:38 PMDavid Kubecka
01/02/2023, 5:53 PMsourceDir
then I would expect that the generated classes are compiled into the classes
folder, which they are not...David Kubecka
01/02/2023, 5:59 PMadd-sources
goal of the build-helper-maven-plugin
. But then I don't understand why the source as added by kapt (as you say) doesn't get compiled...