[
https://issues.apache.org/jira/browse/MCOMPILER-567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17798896#comment-17798896
]
Stefan Cordes edited comment on MCOMPILER-567 at 12/20/23 10:01 AM:
--------------------------------------------------------------------
I faced the similar error
{code:java}
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.12.0:testCompile
(default-testCompile) ....
Fatal error compiling: basedir
...\target\generated-test-sources\test-annotations does not exist -> [Help 1]
{code}
and investigating I see it is not on all projects but only on these where the
message
{code:java}
[INFO] --- maven-compiler-plugin:3.12.0:testCompile (default-testCompile) @ ...
---
[INFO] Recompiling the module because of changed dependency.
{code}
above is printed.
*Workaround* for me was to add
{code:java}
<useIncrementalCompilation>false</useIncrementalCompilation>{code}
to the maven-compiler-plugin-configuration. (even it is not recommended, but we
are running mvn +clean+ deploy on our build anyway ).
Now same build prints
{code:java}
[INFO] --- maven-compiler-plugin:3.12.0:testCompile (default-testCompile) @
... --
[INFO] Nothing to compile - all classes are up to date.{code}
and no error comes up.
was (Author: JIRAUSER303578):
I faced the similar error
{code:java}
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.12.0:testCompile
(default-testCompile) ....
Fatal error compiling: basedir
...\target\generated-test-sources\test-annotations does not exist -> [Help 1]
{code}
and investigating I see it is not on all projects but only on these where the
message
{code:java}
[INFO] --- maven-compiler-plugin:3.12.0:testCompile (default-testCompile) @ ...
---
[INFO] Recompiling the module because of changed dependency.
{code}
above is printed.
*Workaround* for me was to add
{code:java}
<useIncrementalCompilation>false</useIncrementalCompilation>{code}
to the maven-compiler-plugin-configuration. (even it is not recommended, but we
are running mvn +clean+ deploy on our build anyway ).
Now same build prints
{code:java}
[INFO] --- maven-compiler-plugin:3.12.0:testCompile (default-testCompile) @
... --- [INFO] Nothing to compile - all classes are up to date.{code}
and no error comes up.
> Fail to compile if the "generated-sources/annotations" does not exist
> ---------------------------------------------------------------------
>
> Key: MCOMPILER-567
> URL: https://issues.apache.org/jira/browse/MCOMPILER-567
> Project: Maven Compiler Plugin
> Issue Type: Bug
> Affects Versions: 3.12.0
> Reporter: Jorge Solórzano
> Assignee: Slawomir Jaranowski
> Priority: Critical
> Labels: pull-request-available
> Fix For: 3.12.1
>
>
> On some configurations (like a Kotlin project), the cleanup of the
> generated-soruces/annotations directory returns an error:
> {code:java}
> Caused by: java.lang.IllegalStateException: basedir
> /maven-compiler-plugin/target/it/MCOMPILER-XX/target/generated-sources/annotations
> does not exist
> at org.codehaus.plexus.util.DirectoryScanner.scan
> (DirectoryScanner.java:268)
> at
> org.codehaus.plexus.compiler.AbstractCompiler.getSourceFilesForSourceRoot
> (AbstractCompiler.java:168)
> at org.codehaus.plexus.compiler.AbstractCompiler.getSourceFiles
> (AbstractCompiler.java:194)
> at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile
> (JavacCompiler.java:138)
> at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute
> (AbstractCompilerMojo.java:1187)
> at org.apache.maven.plugin.compiler.CompilerMojo.execute
> (CompilerMojo.java:212)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
> (DefaultBuildPluginManager.java:126)
> at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2
> (MojoExecutor.java:328)
> at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute
> (MojoExecutor.java:316)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:212)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:174)
> at org.apache.maven.lifecycle.internal.MojoExecutor.access$000
> (MojoExecutor.java:75)
> at org.apache.maven.lifecycle.internal.MojoExecutor$1.run
> (MojoExecutor.java:162)
> at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute
> (DefaultMojosExecutionStrategy.java:39)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:159)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:105)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:73)
> at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> (SingleThreadedBuilder.java:53)
> at org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> (LifecycleStarter.java:118)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
> at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
> at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
> at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
> at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
> at jdk.internal.reflect.DirectMethodHandleAccessor.invoke
> (DirectMethodHandleAccessor.java:103)
> at java.lang.reflect.Method.invoke (Method.java:580)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> (Launcher.java:283)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> (Launcher.java:226)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> (Launcher.java:407)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main
> (Launcher.java:348){code}
>
> I didn't catch this earlier since I don't use Kotlin and on a normal project,
> this should not be an issue since the javac documentation mentions that the
> directory, and any necessary subdirectories, will be created if they do not
> already exist.
> But on a somewhat modified project that compiles kotlin source code, this
> triggers an issue on plexus-compiler where the generated-soruces directory
> does not exist.
>
> This might be related to issue MCOMPILER-538, where it claims that generated
> source root is not required for javac, but additional confirmation is
> required.
>
> The fix will be to create the generated sources directory to preserve the
> current behavior.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)