/jasyncapi

/jay-sync-api/ is a Java code-first tool for AsyncAPI specification

Primary LanguageJavaApache License 2.0Apache-2.0


AsyncAPI logo

Building the future of event-driven architectures

We're on a mission to standardize message-based communication and increase interoperability of the different systems out there.

⚠️ This project doesn't support AsyncAPI 1.x

This monorepo stores modules, which simplifies interacting with AsyncAPI in jvm ecosystem.

Index

Monorepo structure

Currently here it's splitted on two submodules:

core

This submodule stores projection of AsyncAPI specification to java classes. Each class is being properly annotated with jsr-305 annotations, which allows to use it in null-safety languages like kotlin without extra headache.

<dependency>
  <groupId>com.asyncapi</groupId>
  <artifactId>asyncapi-core</artifactId>
  <version>1.0.0-EAP</version>
</dependency>

plugin

This submodule stores plugins, which automatizes work with AsyncAPI specification.

Currently here are three plugins:

maven

Maven plugin helps to generate AsyncAPI specification from hand-crafted AsyncAPI class at choosed build cycle step.

<dependency>
  <groupId>com.asyncapi</groupId>
  <artifactId>asyncapi-maven-plugin</artifactId>
  <version>1.0.0-EAP</version>
  <type>maven-plugin</type>
</dependency>

Source code with description and example

gradle

Gradle plugin helps to generate AsyncAPI specification from hand-crafted AsyncAPI class at choosed build cycle step.

Source code with description and example

IDEA

IDEA plugin simplifies work with AsyncAPI specification not only in Intellij IDEA, but in others IDE from JetBrains

JetBrains plugin marketplace

Source code with description and example

Release

Sonatype Instruction with references and clarifications

⚠️ WARNING: next artifacts MUST always have common version at release. Because of dependency of plugins from core

Release maven artifacts:

  • Request credentials for one of AsyncAPI's account on Sonatype's Jira, which is synced with Sonatype's nexus
  • Generate pgp key if it was not generated yet
  • Create /Users/{userName}/.m2/settings.xml
<settings>
  <profiles>
    <profile>
      <id>ossrh</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <gpg.keyname>GPG key name</gpg.keyname>
        <gpg.executable>gpg</gpg.executable>
        <gpg.passphrase>GPG passphrase for selected key</gpg.passphrase>
        <gpg.homedir>/Users/{userName}/.gnupg</gpg.homedir>
      </properties>
    </profile>
  </profiles>
  <servers>
    <server>
      <id>ossrh</id>
      <username>Jira username</username>
      <password>Jira password</password>
    </server>
  </servers>
</settings>
  • Choose new release version and set it to root pom.xml.

Example:

<?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>

    <groupId>com.asyncapi</groupId>
    <artifactId>asyncapi</artifactId>
    <version>{new release version}</version>

    <!-- Other project properties was omitted. They are located below and won't be updated generally -->

</project>

Example

<?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">
    <parent>
        <artifactId>asyncapi-plugin</artifactId>
        <groupId>com.asyncapi</groupId>
        <version>{new release version}</version>
    </parent>

    <!-- Other project properties was omitted. They are located below and won't be updated generally -->

</project>
  • Build it, test it and release it to maven central repository
➜  async-api git:(1.0.0-EAP) ✗ mvn clean deploy -P release 

Release gradle artifacts:

release to maven central

gradle gpg instruction
sonatype's instruction for deployment releasing

  • Request credentials for one of AsyncAPI's account on Sonatype's Jira, which is synced with Sonatype's nexus
  • Generate pgp key if it was not generated yet
    • export secret key ring file containing your private key
      gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
  • Create /Users/{userName}/.gradle/gradle.properties
# gpg
signing.keyId={key name}
signing.password={key passphrase}
signing.secretKeyRingFile=/Users/{userName}/.gnupg/secring.gpg

# oss.sonatype.org
ossrhUsername={Jira username}
ossrhPassword={Jira password}
version = "{new release version}"
  • Build it, test it and release it to maven central repository
➜  asyncapi-plugin-gradle git:(1.0.0-EAP) ✗ ./gradlew publishPluginMavenPublicationToMavenRepository
  • Go to stagin repositories and release it manually
    • Select repository
    • Click close and wait some time
    • Click release

release to gradle plugins

  • Request key and secret for gradle account
  • Update /Users/{userName}/.gradle/gradle.properties with gradle credential
gradle.publish.key={key}
gradle.publish.secret={secret}
➜  asyncapi-plugin-gradle git:(1.0.0-EAP) ✗ ./gradlew publishPlugins