[ 
https://issues.apache.org/jira/browse/MCOMPILER-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17378813#comment-17378813
 ] 

Matt Sicker commented on MCOMPILER-461:
---------------------------------------

In my scenario, I added a second annotation processor, and based on some 
inexplicable changes (absolutely nothing in the diff hints at anything useful), 
I'm getting the old compiler error you discovered here despite all the maven 
compiler configurations present in master right now. See attached [^wtf] where 
seemingly innocuous changes are causing a completely unrelated and entirely 
untouched file to cause the given compile error. Modifying the Activator class 
to stop referencing the generated class still causes the log4j-core module to 
fail with a fairly useless stacktrace:

{{org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile 
(default-compile) on project log4j-core: Compilation failure
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:215)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:156)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:148)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
(LifecycleModuleBuilder.java:117)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
(LifecycleModuleBuilder.java:81)
 at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
 (SingleThreadedBuilder.java:56)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute 
(LifecycleStarter.java:128)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
 at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
 at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
 at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
 at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
 at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
 at jdk.internal.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:78)
 at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke (Method.java:567)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced 
(Launcher.java:282)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode 
(Launcher.java:406)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: 
Compilation failure
 at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute 
(AbstractCompilerMojo.java:1224)
 at org.apache.maven.plugin.compiler.CompilerMojo.execute 
(CompilerMojo.java:187)
 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
(DefaultBuildPluginManager.java:137)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:210)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:156)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:148)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
(LifecycleModuleBuilder.java:117)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
(LifecycleModuleBuilder.java:81)
 at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
 (SingleThreadedBuilder.java:56)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute 
(LifecycleStarter.java:128)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
 at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
 at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
 at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
 at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
 at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
 at jdk.internal.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:78)
 at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke (Method.java:567)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced 
(Launcher.java:282)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode 
(Launcher.java:406)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)}}

> Compile fails when class references a class generated by an annotation 
> processor and module-info.java is present
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: MCOMPILER-461
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-461
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.8.1
>         Environment: MacOS 10.15.7. 
> Maven home: /opt/maven/maven
> Java version: 11.0.10, vendor: Amazon.com Inc., runtime: 
> /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
>            Reporter: Ralph Goers
>            Priority: Major
>         Attachments: mvn.txt, wtf
>
>
> While trying to convert Log4j-core to a JPMS module I have run into an issue 
> where I have a class that references a class that is generated by Log4j's 
> annotation processor and that class gets an error saying the referenced class 
> cannot be found. However, after the compile fails I can see that the file was 
> generated.
> To reproduce:
> git clone [https://github.com/apache/logging-log4j2.git
> ]cd logging-log4j2
> git checkout module-compile-fails
> mvn clean install
> The compile will fail in log4j-core. Some appear to be errors in javac for 
> which I have opened an issue with openjdk. But if I do "mvn -X clean install" 
> and copy the compile command line and prepend it with javac when it runs I no 
> longer see
> [ERROR] 
> /Users/rgoers/projects/apache/logging/log4j/logging-log4j2/log4j-core/src/main/java/org/apache/logging/log4j/core/osgi/Activator.java:[29,44]
>  error: cannot find symbol symbol: class Log4jPlugins location: package 
> org.apache.logging.log4j.core.plugins 
> which indicates that Maven is somehow causing that.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to