5.2. Maven 플러그인을 사용하여 스키마 및 API 아티팩트 다운로드
Maven 플러그인을 사용하여 서비스 레지스트리에서 아티팩트를 다운로드할 수 있습니다. 이는 예를 들어 등록된 스키마에서 코드를 생성할 때 유용합니다.
사전 요구 사항
- 클라이언트 애플리케이션에 대한 Maven 프로젝트를 생성했습니다. 자세한 내용은 Apache Maven 설명서 를 참조하십시오.
프로세스
apicurio-registry-maven-plugin
을 사용하여 아티팩트를 다운로드하도록 Mavenpom.xml
파일을 업데이트합니다. 다음 예제에서는 Apache Avro 및 GraphQL 스키마를 다운로드하는 방법을 보여줍니다.<plugin> <groupId>io.apicurio</groupId> <artifactId>apicurio-registry-maven-plugin</artifactId> <version>${apicurio.version}</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>download</goal> 1 </goals> <configuration> <registryUrl>MY-REGISTRY-URL/apis/registry/v2</registryUrl> 2 <authServerUrl>MY-AUTH-SERVER</authServerUrl> <clientId>MY-CLIENT-ID</clientId> <clientSecret>MY-CLIENT-SECRET</clientSecret> 3 <clientScope>MY-CLIENT-SCOPE</clientScope> <artifacts> <artifact> <groupId>TestGroup</groupId> 4 <artifactId>FullNameRecord</artifactId> 5 <file>${project.build.directory}/classes/record.avsc</file> <overwrite>true</overwrite> </artifact> <artifact> <groupId>TestGroup</groupId> <artifactId>ExampleAPI</artifactId> <version>1</version> <file>${project.build.directory}/classes/example.graphql</file> <overwrite>true</overwrite> </artifact> </artifacts> </configuration> </execution> </executions> </plugin>
-
예를 들어
mvn package
명령을 사용하여 Maven 프로젝트를 빌드합니다.
추가 리소스
- Apache Maven 사용에 대한 자세한 내용은 Apache Maven 설명서를 참조하십시오.
- Service Registry Maven 플러그인 사용의 오픈 소스 예제는 Apicurio 레지스트리 데모 예제 를 참조하십시오.