java - How do I run annotation processing via maven 3.3? -


for years, we've been running maven-processor-plugin separate goal (using proc:none on maven-compiler-plugin). finally upgrading maven 3.0.5 latest 3.3.3, , see maven-processor-plugin looks dead. far can tell, has not been migrated out of google code.

we're using annotation processing generate dagger classes. can't remember reasons, @ time (in dagger-1), got impression better during generate-sources , generate-test-sources phases rather during compile , test-compile, why used maven-processor-plugin begin with. note want play nicely in eclipse/m2e well.

is there new, better way run annotation processing maven eclipse-friendly?

you can use maven-compiler-plugin annotation processing because functionality exists in javac. annotation processing , regular compilation in separate phases, can multiple executions of plugin, 1 annotation processing turned on, other turned off. configuration follows:

<plugin>     <groupid>org.apache.maven.plugins</groupid>     <artifactid>maven-compiler-plugin</artifactid>     <version>3.5</version>     <executions>         <execution>             <id>process-annotations</id>             <phase>generate-sources</phase>             <goals>                 <goal>compile</goal>             </goals>             <configuration>                 <compilerargs>                     <arg>-proc:only</arg>                     <arg>-processor</arg>                     <arg>myannotationprocessor</arg>                 </compilerargs>             </configuration>         </execution>         <execution>             <id>default-compile</id> <!-- using id of default-compile override default execution -->             <phase>compile</phase>             <goals>                 <goal>compile</goal>             </goals>             <configuration>                 <compilerargs>                     <arg>-proc:none</arg>                 </compilerargs>             </configuration>         </execution>     </executions> </plugin> 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -