如何将服务代理与 vertx fabric8 插件一起使用

How do I use service proxy with vertx fabric8 plugin

我正在尝试按照 Java 开发者教程指南中的说明使用 vertx-service-proxy。 在其中,它说我需要将以下内容添加到我的 pom:

<annotationProcessors>
  <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
</annotationProcessors>
<generatedSourcesDirectory>${project.basedir}/src/main/generated</generatedSourcesDirectory>
<compilerArgs>
  <arg>-AoutputDirectory=${project.basedir}/src/main</arg>
</compilerArgs>

但是,我想使用 fabric8 vertx-maven-plugin,而不是 maven 编译器插件。是否可以使用 fabric8 vertx-maven-plugin 并使用 vertx-service-proxy?我应该把 codegen annotationProcessors 部分放在哪里?

这是我的构建插件的样子:

<build>
    <plugins>
        <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>vertx-maven-plugin</artifactId>
            <version>${vertx-maven-plugin.version}</version>
            <executions>
                <execution>
                    <id>vmp</id>
                    <goals>
                        <goal>initialize</goal>
                        <goal>package</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <redeploy>true</redeploy>
            </configuration>
        </plugin>

    </plugins>
</build>

我尝试在上面的配置标签中添加 annotationProcessors 标签,但它无效。

有什么想法吗?谢谢。

好吧,我应该在发布之前多阅读文档..

我只需要将 <classifier>processor</classifier> 添加到我的 pom:

<dependency>
  <groupId>io.vertx</groupId>
  <artifactId>vertx-service-proxy</artifactId>
  <version>3.5.0</version>
  <classifier>processor</classifier>
</dependency>

然后我还需要在我的服务 class 所在的位置定义一个 package-info.java 文件。 之后,即使使用 fabric8 vertx-maven-plugin,代理也能正常生成。