|
<?xml version="1.0" encoding="UTF-8"?> |
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
<modelVersion>4.0.0</modelVersion> |
|
|
|
<parent> |
|
<groupId>org.springframework.boot</groupId> |
|
<artifactId>spring-boot-starter-parent</artifactId> |
|
<version>2.6.10</version> |
|
<relativePath/> |
|
</parent> |
|
|
|
<build> |
|
<plugins> |
|
<plugin> |
|
<groupId>org.springframework.boot</groupId> |
|
<artifactId>spring-boot-maven-plugin</artifactId> |
|
</plugin> |
|
<!-- step one: download the files (if required) --> |
|
<!-- the downside is that using this method we --> |
|
<!-- dont support splitting schema in multiple --> |
|
<!-- files... --> |
|
<plugin> |
|
<groupId>com.googlecode.maven-download-plugin</groupId> |
|
<artifactId>download-maven-plugin</artifactId> |
|
<version>1.6.8</version> |
|
<executions> |
|
<execution> |
|
<id>download-asyncapi-one-spec</id> |
|
<phase>initialize</phase> |
|
<goals> |
|
<goal>wget</goal> |
|
</goals> |
|
<configuration> |
|
<url>https://example.com/my-api-one.yaml</url> |
|
</configuration> |
|
</execution> |
|
<execution> |
|
<id>download-asyncapi-two-spec</id> |
|
<phase>initialize</phase> |
|
<goals> |
|
<goal>wget</goal> |
|
</goals> |
|
<configuration> |
|
<url>https://example.com/my-api-two.yaml</url> |
|
</configuration> |
|
</execution> |
|
</executions> |
|
<configuration> |
|
<outputDirectory>${project.build.directory}/generated-sources/asyncapi</outputDirectory> |
|
<skipCache>true</skipCache> |
|
<headers> |
|
<authorization>token gh_xxxxxxxxxxxxxxxxxxxx</authorization> |
|
</headers> |
|
</configuration> |
|
</plugin> |
|
|
|
<!-- step two: use the exec-maven-plugin to invoke the asyncapi generator --> |
|
<plugin> |
|
<groupId>org.codehaus.mojo</groupId> |
|
<artifactId>exec-maven-plugin</artifactId> |
|
<version>3.0.0</version> |
|
<executions> |
|
<execution> |
|
<id>asyncapi-generate-worker-client</id> |
|
<phase>generate-sources</phase> |
|
<goals> |
|
<goal>exec</goal> |
|
</goals> |
|
<configuration> |
|
<executable>ag</executable> |
|
<arguments> |
|
<argument>${project.build.directory}/generated-sources/asyncapi/one.yaml</argument> |
|
<argument>@joaomlneto/asyncapi-spring-websockets-template</argument> |
|
<argument>-o</argument> |
|
<argument>${project.build.directory}/generated-sources/asyncapi-one-client</argument> |
|
<argument>-p</argument> |
|
<argument>javaPackage=myorg.api.one</argument> |
|
</arguments> |
|
</configuration> |
|
</execution> |
|
<execution> |
|
<id>asyncapi-generate-scheduler-client</id> |
|
<phase>generate-sources</phase> |
|
<goals> |
|
<goal>exec</goal> |
|
</goals> |
|
<configuration> |
|
<executable>ag</executable> |
|
<arguments> |
|
<argument>${project.build.directory}/generated-sources/asyncapi/two.yaml</argument> |
|
<argument>@joaomlneto/asyncapi-spring-websockets-template</argument> |
|
<argument>-o</argument> |
|
<argument>${project.build.directory}/generated-sources/asyncapi-two-client</argument> |
|
<argument>-p</argument> |
|
<argument>javaPackage=myorg.api.two</argument> |
|
</arguments> |
|
</configuration> |
|
</execution> |
|
</executions> |
|
</plugin> |
|
|
|
<!-- step three: signal maven to consider the newly-generated directories as source directories --> |
|
<plugin> |
|
<groupId>org.codehaus.mojo</groupId> |
|
<artifactId>build-helper-maven-plugin</artifactId> |
|
<version>3.2.0</version> |
|
<executions> |
|
<execution> |
|
<id>add-asyncapi-sources</id> |
|
<phase>generate-sources</phase> |
|
<goals> |
|
<goal>add-source</goal> |
|
</goals> |
|
<configuration> |
|
<sources> |
|
<source>${project.build.directory}/generated-sources/asyncapi-scheduler-client/src/main/java</source> |
|
<source>${project.build.directory}/generated-sources/asyncapi-worker-client/src/main/java</source> |
|
</sources> |
|
</configuration> |
|
</execution> |
|
</executions> |
|
</plugin> |
|
</plugins> |
|
</build> |
|
|
|
</project> |