Hi Mark,

The javadoc of annotationProcessorPaths [1] is not very reassuring for your
intended use case:

"Classpath elements to supply as annotation processor path. If specified,
the compiler will detect annotation processors only in those classpath
elements."

That makes it sounds like it merely limits which classpath elements are
allowed to provide annotation processors—not expand annotation processing
capabilities outside of the normal classpath.

However, the integration test exercising this feature [2] does exactly that
[3], declaring org.issue:annotation-processor as an
annotationProcessingPath but not declaring it in the dependencies at all.
In that case though, unlike your use case, the whole shebang is part of a
multi-module reactor... maybe that makes a difference in whether it works?


Regards,
Curtis

[1]
https://github.com/apache/maven-plugins/blob/cb254e434a40b7ff58c936abbb3f823029a0e466/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java#L227-L254

[2]
https://github.com/apache/maven-plugins/tree/cb254e434a40b7ff58c936abbb3f823029a0e466/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath

[3]
https://github.com/apache/maven-plugins/blob/cb254e434a40b7ff58c936abbb3f823029a0e466/maven-compiler-plugin/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml#L58-L64


On Thu, Mar 24, 2016 at 7:21 PM, Christopher <ctubb...@apache.org> wrote:

> The only annotation processor I use is Google's auto-service. I didn't find
> this to be setting to be useful at all in that case, because I still need
> the auto-service on the classpath (as an optional dependency) so I can
> actually use the @AutoService annotation in my source. I didn't try it with
> any other annotation processor, which would work without being on the
> classpath.
>
> On Wed, Mar 23, 2016 at 7:37 PM Mark Derricutt <m...@talios.com> wrote:
>
> > Hey all,
> >
> > Has anyone successfully used the new <annotationProcessorPaths> setting
> > in the maven-compiler-plugin at all?
> >
> > I'm adding:
> >
> > <annotationProcessorPaths>
> >   <path>
> >     <groupId>com.google.dagger</groupId>
> >     <artifactId>dagger-compiler</artifactId>
> >     <version>2.1</version>
> >   </path></annotationProcessorPaths>
> >
> > to my compiler plugins configuration but it doesn't seem to work, when
> > running maven with -X I see the configuration is picked up, but it
> doesn't
> > seem to get passed to the compiler at all?
> >
> > [DEBUG] Goal:
> org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile
> (default-compile)
> > [DEBUG] Style:         Regular
> > [DEBUG] Configuration: <?xml version="1.0"
> encoding="UTF-8"?><configuration>
> >   <annotationProcessorPaths>
> >     <path>
> >       <groupId>com.google.dagger</groupId>
> >       <artifactId>dagger-compiler</artifactId>
> >       <version>2.1</version>
> >     </path>
> >   </annotationProcessorPaths>
> >   <basedir default-value="${basedir}"/>
> >   <buildDirectory default-value="${project.build.directory}"/>
> >   <classpathElements
> default-value="${project.compileClasspathElements}"/>
> >   <compileSourceRoots default-value="${project.compileSourceRoots}"/>
> >   <compilerId
> default-value="javac">${maven.compiler.compilerId}</compilerId>
> >   <compilerReuseStrategy
> default-value="${reuseCreated}">${maven.compiler.compilerReuseStrategy}</compilerReuseStrategy>
> >   <compilerVersion>${maven.compiler.compilerVersion}</compilerVersion>
> >   <debug default-value="true">${maven.compiler.debug}</debug>
> >   <debuglevel>${maven.compiler.debuglevel}</debuglevel>
> >   <encoding
> default-value="${project.build.sourceEncoding}">${encoding}</encoding>
> >   <executable>${maven.compiler.executable}</executable>
> >   <failOnError
> default-value="true">${maven.compiler.failOnError}</failOnError>
> >   <forceJavacCompilerUse
> default-value="false">${maven.compiler.forceJavacCompilerUse}</forceJavacCompilerUse>
> >   <fork default-value="false">${maven.compiler.fork}</fork>
> >   <generatedSourcesDirectory
> default-value="${project.build.directory}/generated-sources/annotations"/>
> >   <maxmem>${maven.compiler.maxmem}</maxmem>
> >   <meminitial>${maven.compiler.meminitial}</meminitial>
> >   <mojoExecution default-value="${mojoExecution}"/>
> >   <optimize default-value="false">${maven.compiler.optimize}</optimize>
> >   <outputDirectory default-value="${project.build.outputDirectory}"/>
> >   <project default-value="${project}"/>
> >   <projectArtifact default-value="${project.artifact}"/>
> >   <session default-value="${session}"/>
> >   <showDeprecation
> default-value="false">${maven.compiler.showDeprecation}</showDeprecation>
> >   <showWarnings
> default-value="false">${maven.compiler.showWarnings}</showWarnings>
> >   <skipMain>${maven.main.skip}</skipMain>
> >   <skipMultiThreadWarning
> default-value="false">${maven.compiler.skipMultiThreadWarning}</skipMultiThreadWarning>
> >   <source default-value="1.5">${maven.compiler.source}</source>
> >   <staleMillis default-value="0">${lastModGranularityMs}</staleMillis>
> >   <target default-value="1.5">${maven.compiler.target}</target>
> >   <useIncrementalCompilation
> default-value="true">${maven.compiler.useIncrementalCompilation}</useIncrementalCompilation>
> >   <verbose
> default-value="false">${maven.compiler.verbose}</verbose></configuration>
> >
> > When running the compiler with <verbose>true</verbose> I don't see the
> > dagger-compiler artefact anywhere on the paths mentioned ( to be expected
> > since it should be on the annotation path not class-path, but we don't
> > print out the annotation path ).
> >
> > Am I missing something simple? Including dagger-compiler as a normal
> > dependency works fine, but then bleeds into the class path.
> >
> > Mark
> >
> > --
> > Mark Derricutt
> > http://www.theoryinpractice.net
> > http://www.chaliceofblood.net
> > http://plus.google.com/+MarkDerricutt
> > http://twitter.com/talios
> > http://facebook.com/mderricutt
> >
>

Reply via email to