小编Rap*_*ter的帖子

将参数传递给注释处理器

我正在使用注释处理来生成一些类...我有两个模块,处理器本身和使用它的“客户端”模块。我想通过客户端将参数传递给处理器,这是我喜欢的

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                    <generatedSourcesDirectory>${project.build.directory}/generated-sources/</generatedSourcesDirectory>
                    <annotationProcessors>
                        <annotationProcessor>org.rapster.xxx.xxx.xxComponentProcessor</annotationProcessor>
                    </annotationProcessors>
                    <compilerArgs>
                       <arg>-Awidget=something</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
        </plugins>
    </build>
Run Code Online (Sandbox Code Playgroud)

以及如何在处理器端检索这个参数?

java annotations maven

5
推荐指数
1
解决办法
3222
查看次数

标签 统计

annotations ×1

java ×1

maven ×1