You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "cbarlin (via GitHub)" <gi...@apache.org> on 2026/03/10 10:06:13 UTC
[I] Dependencies of `modular-processor` fail if project uses them with a different `type` [maven-compiler-plugin]
cbarlin opened a new issue, #1039:
URL: https://github.com/apache/maven-compiler-plugin/issues/1039
### Affected version
4.0.0-rc-5
### Bug description
Not sure if this is a bug in the compiler plugin or in `javac`, but if you have a dependency that is marked with a type of `modular-processor` and it depends on a module that you also depend on (as in, type `modular-jar`), then `javac` throws an `java.lang.module.FindException`.
Using my (admittedly quite large, sorry) project as an example you can [see here](https://github.com/cbarlin/advanced-record-utils/blob/maven_4/aru-processor-core/pom.xml#L71) I've declared my dependencies like so:
```xml
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-inject</artifactId>
<version>${avaje-inject.version}</version>
<type>modular-jar</type>
</dependency>
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-inject-generator</artifactId>
<version>${avaje-inject.version}</version>
<type>modular-processor</type>
</dependency>
```
(note: `avaje-inject-generator` itself depends on `avaje-inject`).
When running `mvn compile` though, the below stack trace occurs:
<details>
<summary>Stack trace</summary>
```
[INFO] --- compiler:4.0.0-beta-4:compile (default-compile) @ aru-processor-core ---
[WARNING] Parameter 'debug' (user property 'maven.compiler.debug') is deprecated: Setting this flag to false is replaced by <debuglevel>none</debuglevel>.
[INFO] Compiling all files.
[INFO]
[ERROR] An exception has occurred in the compiler (25). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.module.FindException: Module io.avaje.inject not found, required by io.avaje.inject.generator
at java.base/java.lang.module.Resolver.findFail(Resolver.java:921)
at java.base/java.lang.module.Resolver.resolve(Resolver.java:192)
at java.base/java.lang.module.Resolver.bind(Resolver.java:315)
at java.base/java.lang.module.Resolver.bind(Resolver.java:219)
at java.base/java.lang.module.Configuration.resolveAndBind(Configuration.java:543)
at java.base/java.lang.module.Configuration.resolveAndBind(Configuration.java:347)
at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getServiceLoader(JavacFileManager.java:1169)
at jdk.compiler/com.sun.tools.javac.main.DelegatingJavaFileManager.getServiceLoader(DelegatingJavaFileManager.java:169)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.initProcessorLoader(JavacProcessingEnvironment.java:270)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.<init>(JavacProcessingEnvironment.java:240)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.instance(JavacProcessingEnvironment.java:195)
at jdk.compiler/com.sun.tools.javac.api.BasicJavacTask.initPlugins(BasicJavacTask.java:218)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.prepareCompiler(JavacTaskImpl.java:204)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:101)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
at org.apache.maven.plugin.compiler.ToolExecutor.compile(ToolExecutor.java:968)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.compile(AbstractCompilerMojo.java:1381)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1190)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager$MojoWrapper.execute(DefaultBuildPluginManager.java:244)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:339)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:310)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:214)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:179)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:168)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:110)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:61)
at org.apache.maven.lifecycle.internal.DefaultLifecycleStarter.execute(DefaultLifecycleStarter.java:123)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:310)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:225)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:149)
at org.apache.maven.cling.invoker.mvn.MavenInvoker.doExecute(MavenInvoker.java:452)
at org.apache.maven.cling.invoker.mvn.MavenInvoker.execute(MavenInvoker.java:97)
at org.apache.maven.cling.invoker.mvn.MavenInvoker.execute(MavenInvoker.java:81)
at org.apache.maven.cling.invoker.LookupInvoker.doInvoke(LookupInvoker.java:165)
at org.apache.maven.cling.invoker.LookupInvoker.invoke(LookupInvoker.java:134)
at org.apache.maven.cling.ClingSupport.run(ClingSupport.java:76)
at org.apache.maven.cling.MavenCling.main(MavenCling.java:51)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
[ERROR] COMPILATION ERROR: Cannot compile io.github.cbarlin:aru-processor-core:jar:0.8.2-SNAPSHOT main classes.
[INFO] For trying to compile from the command-line, use:
cd aru-processor-core
javac @target/javac.args
```
</details>
Looking at the javac args that are given, it seems that `avaje-inject-generator` is included in `--processor-module-path` and `avaje-inject` is included in `--module-path`
<details>
<summary>Resulting javac args</summary>
```
--release 21
-proc:full
-g:none
--module-version 0.8.2-SNAPSHOT
--module-path "/home/conrad/.m2/repository/org/jspecify/jspecify/1.0.0/jspecify-1.0.0.jar:../advanced-record-utils-annotations/target/classes:../aru-prism-prison/target/classes:/home/conrad/.m2/repository/io/micronaut/sourcegen/micronaut-sourcegen-generator-java/1.8.4/micronaut-sourcegen-generator-java-1.8.4.jar:/home/conrad/.m2/repository/org/apache/commons/commons-lang3/3.20.0/commons-lang3-3.20.0.jar:/home/conrad/.m2/repository/com/github/ben-manes/caffeine/caffeine/3.2.3/caffeine-3.2.3.jar:/home/conrad/.m2/repository/io/avaje/avaje-inject/12.4/avaje-inject-12.4.jar:/home/conrad/.m2/repository/com/google/errorprone/error_prone_annotations/2.43.0/error_prone_annotations-2.43.0.jar:/home/conrad/.m2/repository/jakarta/inject/jakarta.inject-api/2.0.1/jakarta.inject-api-2.0.1.jar:/home/conrad/.m2/repository/io/avaje/avaje-inject-aop/12.4/avaje-inject-aop-12.4.jar:/home/conrad/.m2/repository/io/avaje/avaje-applog/1.2/avaje-applog-1.2.jar:/home/conrad/.m2/repository/io/avaje/avaje-inj
ect-events/12.4/avaje-inject-events-12.4.jar:/home/conrad/.m2/repository/io/avaje/avaje-prism-core/2.0/avaje-prism-core-2.0.jar:/home/conrad/.m2/repository/io/avaje/avaje-spi-core/2.16/avaje-spi-core-2.16.jar"
--processor-module-path "/home/conrad/.m2/repository/io/avaje/avaje-inject-generator/12.4/avaje-inject-generator-12.4.jar:/home/conrad/.m2/repository/io/avaje/avaje-prisms/2.0/avaje-prisms-2.0.jar:/home/conrad/.m2/repository/io/avaje/avaje-spi-service/2.16/avaje-spi-service-2.16.jar"
--source-path "src/main/java"
-d "target/classes"
"src/main/java/io/github/cbarlin/aru/core/ClaimableOperation.java"
"src/main/java/io/github/cbarlin/aru/core/ExecutableElementUtils.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/ImportAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/PackageTargetAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/TargetAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/TargetAnalysisResult.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/RecordTargetAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/ConcreteTargetAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/InterfaceTargetAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/LibraryLoadedTargetAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/analysers/TypeConverterAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/BuilderClass.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/UtilsClass.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/sorting/AnnotationSpecComparator.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/sorting/FieldSpecComparator.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/sorting/TypeNameComparator.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/sorting/MethodSpecComparator.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/sorting/TypeSpecComparator.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/ToBeBuilt.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/GenerationArtifact.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/IToBeBuilt.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/PreBuilt.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/ToBeBuiltClass.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/ToBeBuiltInterface.java"
"src/main/java/io/github/cbarlin/aru/core/artifacts/ToBeBuiltRecord.java"
"src/main/java/io/github/cbarlin/aru/core/factories/BeanScopeFactory.java"
"src/main/java/io/github/cbarlin/aru/core/factories/InterfaceElementPrismFactory.java"
"src/main/java/io/github/cbarlin/aru/core/factories/RecordComponentPrismFactory.java"
"src/main/java/io/github/cbarlin/aru/core/factories/RecordElementPrismFactory.java"
"src/main/java/io/github/cbarlin/aru/core/factories/SupportedAnnotations.java"
"src/main/java/io/github/cbarlin/aru/core/factories/SupportedAnnotationsFactory.java"
"src/main/java/io/github/cbarlin/aru/core/factories/PropertyConfigLoader.java"
"src/main/java/io/github/cbarlin/aru/core/factories/UseInterfaceDefaultClassFactory.java"
"src/main/java/io/github/cbarlin/aru/core/impl/ScopeHolder.java"
"src/main/java/io/github/cbarlin/aru/core/impl/logging/NoOpAppLog.java"
"src/main/java/io/github/cbarlin/aru/core/impl/logging/NoOpHandler.java"
"src/main/java/io/github/cbarlin/aru/core/impl/logging/NoOpLogger.java"
"src/main/java/io/github/cbarlin/aru/core/impl/types/analyser/BasicAnalyser.java"
"src/main/java/io/github/cbarlin/aru/core/impl/types/analyser/CoreSpecialisedComponentFactory.java"
"src/main/java/io/github/cbarlin/aru/core/impl/visitors/BuilderClassCreatorVisitor.java"
"src/main/java/io/github/cbarlin/aru/core/impl/visitors/InterfaceUtilsJavadocVisitor.java"
"src/main/java/io/github/cbarlin/aru/core/impl/visitors/builder/AddEmptyConstruction.java"
"src/main/java/io/github/cbarlin/aru/core/impl/visitors/builder/AddCopyConstruction.java"
"src/main/java/io/github/cbarlin/aru/core/impl/visitors/builder/AddGetter.java"
"src/main/java/io/github/cbarlin/aru/core/impl/visitors/builder/AddField.java"
"src/main/java/io/github/cbarlin/aru/core/impl/visitors/builder/AddPlainBuild.java"
"src/main/java/io/github/cbarlin/aru/core/impl/visitors/builder/AddSetter.java"
"src/main/java/io/github/cbarlin/aru/core/mirrorhandlers/MergedMirror.java"
"src/main/java/io/github/cbarlin/aru/core/mirrorhandlers/SyntheticAnnotationValue.java"
"src/main/java/io/github/cbarlin/aru/core/mirrorhandlers/SourceTrackingAnnotationMirror.java"
"src/main/java/io/github/cbarlin/aru/core/mirrorhandlers/StackingAnnotationMirror.java"
"src/main/java/io/github/cbarlin/aru/core/mirrorhandlers/MirrorOfDefaults.java"
"src/main/java/io/github/cbarlin/aru/core/mirrorhandlers/MapBasedAnnotationMirror.java"
"src/main/java/io/github/cbarlin/aru/core/mirrorhandlers/ToPrettierAnnotationSpec.java"
"src/main/java/io/github/cbarlin/aru/core/types/OperationType.java"
"src/main/java/io/github/cbarlin/aru/core/types/components/ConstructorComponent.java"
"src/main/java/io/github/cbarlin/aru/core/types/components/OptionalComponent.java"
"src/main/java/io/github/cbarlin/aru/core/types/components/TypeConverterComponent.java"
"src/main/java/io/github/cbarlin/aru/core/types/components/BasicAnalysedComponent.java"
"src/main/java/io/github/cbarlin/aru/core/types/components/DelegatingComponent.java"
"src/main/java/io/github/cbarlin/aru/core/types/components/AnalysedCollectionComponent.java"
"src/main/java/io/github/cbarlin/aru/core/types/components/AnalysedOptionalComponent.java"
"src/main/java/io/github/cbarlin/aru/core/types/AnalysedInterface.java"
"src/main/java/io/github/cbarlin/aru/core/types/AnalysedComponent.java"
"src/main/java/io/github/cbarlin/aru/core/types/AnalysedRecord.java"
"src/main/java/io/github/cbarlin/aru/core/types/AnalysedTypeConverter.java"
"src/main/java/io/github/cbarlin/aru/core/types/LibraryLoadedTarget.java"
"src/main/java/io/github/cbarlin/aru/core/types/ProcessingTarget.java"
"src/main/java/io/github/cbarlin/aru/core/types/UseInterfaceDefaultClass.java"
"src/main/java/io/github/cbarlin/aru/core/types/AnalysedType.java"
"src/main/java/io/github/cbarlin/aru/core/visitors/InterfaceVisitor.java"
"src/main/java/io/github/cbarlin/aru/core/visitors/RecordVisitor.java"
"src/main/java/io/github/cbarlin/aru/core/visitors/AruVisitor.java"
"src/main/java/io/github/cbarlin/aru/core/visitors/CollectionRecordVisitor.java"
"src/main/java/io/github/cbarlin/aru/core/wiring/CoreGlobalScope.java"
"src/main/java/io/github/cbarlin/aru/core/wiring/CorePerComponentScope.java"
"src/main/java/io/github/cbarlin/aru/core/wiring/CorePerInterfaceScope.java"
"src/main/java/io/github/cbarlin/aru/core/wiring/CorePerRecordScope.java"
"src/main/java/io/github/cbarlin/aru/core/wiring/InjectModuleFinder.java"
"src/main/java/io/github/cbarlin/aru/core/CommonsConstants.java"
"src/main/java/io/github/cbarlin/aru/core/AdvRecUtilsProcessor.java"
"src/main/java/io/github/cbarlin/aru/core/AdvRecUtilsSettings.java"
"src/main/java/io/github/cbarlin/aru/core/AnnotationSupplier.java"
"src/main/java/io/github/cbarlin/aru/core/PreviousCompilationChecker.java"
"src/main/java/io/github/cbarlin/aru/core/TypeElementUtils.java"
"src/main/java/io/github/cbarlin/aru/core/UtilsProcessingContext.java"
"src/main/java/io/github/cbarlin/aru/core/OptionalClassDetector.java"
"src/main/java/module-info.java"
```
</details>
Fiddling around with the arguments, if I copy (not move) the transitive depencies of `avaje-inject-generator` across to the `--processor-module-path` it does seem to move along (in that I get a different error saying that a generated class can't be found - that might be me never having used `javac` directly though).
I'm guessing that the plugin needs to ensure transitive dependencies always end up in the `processor-module-path` even if they are already in the `module-path`? Though to me that seems redundant...
Thanks for all the work you guys do - it's really appreciated!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Dependencies of `modular-processor` fail if project uses them with a different `type` [maven-compiler-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo closed issue #1039: Dependencies of `<type>modular-processor</type>` fail if project uses them with a different `type`
URL: https://github.com/apache/maven-compiler-plugin/issues/1039
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Dependencies of `modular-processor` fail if project uses them with a different `type` [maven-compiler-plugin]
Posted by "desruisseaux (via GitHub)" <gi...@apache.org>.
desruisseaux commented on issue #1039:
URL: https://github.com/apache/maven-compiler-plugin/issues/1039#issuecomment-4033687248
I have not really investigated yet, but I suspect that it may be related to https://github.com/apache/maven/pull/11380. Would it be possible for you to test the following?
* Checkout the master branch of https://github.com/apache/maven
* Apply the https://github.com/apache/maven/pull/11380 pull request.
* Run `mvn install`.
* Unzip `apache-maven/target/apache-maven-4.1.0-SNAPSHOT-bin.zip` somewhere.
* Test your application again with the same Maven compiler plugin (no change on the plugin side).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Dependencies of `modular-processor` fail if project uses them with a different `type` [maven-compiler-plugin]
Posted by "cbarlin (via GitHub)" <gi...@apache.org>.
cbarlin commented on issue #1039:
URL: https://github.com/apache/maven-compiler-plugin/issues/1039#issuecomment-4037097765
Same result I'm afraid (merging PR commit `1e6f23ffb6439eee35aba280bcdb7193d995abe6` into `master` commit `9d9273fa825ffeb3507593555fb20c712681042b` with no conflicts, then building, and then using that `mvn` to do the build).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Dependencies of `modular-processor` fail if project uses them with a different `type` [maven-compiler-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on issue #1039:
URL: https://github.com/apache/maven-compiler-plugin/issues/1039#issuecomment-5458167109
I think this one is fixed now and just not linked to this issue. Comment if that's not true.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Dependencies of `modular-processor` fail if project uses them with a different `type` [maven-compiler-plugin]
Posted by "mariuszs (via GitHub)" <gi...@apache.org>.
mariuszs commented on issue #1039:
URL: https://github.com/apache/maven-compiler-plugin/issues/1039#issuecomment-4063593586
I've submitted a fix for this in #1042. The root cause is that `javac` resolves the processor module layer independently from the application module layer, but Maven's dependency resolver places shared dependencies only on `--module-path`. The fix supplements `--processor-module-path` with `--module-path` entries when processor modules are present.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Dependencies of `modular-processor` fail if project uses them with a different `type` [maven-compiler-plugin]
Posted by "cbarlin (via GitHub)" <gi...@apache.org>.
cbarlin commented on issue #1039:
URL: https://github.com/apache/maven-compiler-plugin/issues/1039#issuecomment-4152743988
I can see that this has been fixed for Maven 4.1.x - will it be backported into Maven 4.0.x before that gets released?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org