// Metadata created by nebel
// ParentAssemblies: assemblies/getting-started/as_installing-the-registry.adoc

[id="testing-artifacts-using-maven-plugin_{context}"]
= Testing schema and API artifacts using the Maven plug-in

[role="_abstract"]
You might want to verify that an artifact can be registered without actually making any changes. This is often useful when rules are configured in {registry}. Testing the artifact results in a failure if the artifact content violates any of the configured rules.

NOTE: When testing artifacts using the Maven plug-in, even if the artifact passes the test, no content is added to {registry}.

.Prerequisites
* You have created a Maven project for your client application. For more details, see the https://maven.apache.org/index.html[Apache Maven documentation].


.Procedure
. Update your Maven `pom.xml` file to use the `apicurio-registry-maven-plugin` to test an artifact. The following example shows testing an Apache Avro schema:
+
[source,xml]
----
<plugin>     
  <groupId>io.apicurio</groupId>
  <artifactId>apicurio-registry-maven-plugin</artifactId>
  <version>${apicurio.version}</version>
  <executions>
      <execution>
        <phase>generate-sources</phase>
        <goals>
            <goal>test-update</goal>  <1>
        </goals>
        <configuration>
            <registryUrl>MY-REGISTRY-URL/apis/registry/v3</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>
                    <file>${project.basedir}/src/main/resources/schemas/record.avsc</file> <5>
                </artifact>
            </artifacts>
        </configuration>
    </execution>
  </executions>
 </plugin>
----
+
<1> Specify `test-update` as the execution goal to test the schema artifact.
<2> Specify the {registry} URL with the `../apis/registry/v3` endpoint.
<3> If authentication is required, you can specify your authentication server and client credentials.
<4> Specify the {registry} artifact group ID. You can specify the `default` group if you do not want to use a unique group.
<5> You can test multiple artifacts from a specified directory using the artifact ID. 

. Build your Maven project, for example, by using the `mvn package` command. 

[role="_additional-resources"]
.Additional resources
 * For more details on using Apache Maven, see the https://maven.apache.org/index.html[Apache Maven documentation].
 * For open source examples of using the {registry} Maven plug-in, see the link:https://github.com/Apicurio/apicurio-registry/tree/main/examples[Apicurio Registry demonstration examples].