sngular / scs-multiapi-plugin

This is a Maven plugin designed to help developers automatizing the creation of code classes from YML files based on AsyncApi and OpenAPI.
http://sngular.com
Mozilla Public License 2.0
46 stars 10 forks source link

No files are generated in the build generated-sources folder #261

Closed novaross closed 1 year ago

novaross commented 1 year ago

I am trying to generate code from the async api yaml file, and following the instructions from the readme page. A valid async api yaml file is located in the ./src/main/resources/asyncapi/sampleapi.yaml folder of the project. My build.gradle file is attached below, this is a standard build.gradle created by spring initializr. After adding the asyncapimodel section, I can see the new asyncApiTask in the gradle task view in Intellij. When i run the dedicated asyncApiTask or the build task, the build is successful without any errors or warnings, but nothing is generated in the generated-sources folder. Am i missing something some of the configuration? Thanks in advance for your assistance!

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.1.1'
    id 'io.spring.dependency-management' version '1.1.0'
    id "com.sngular.scs-multiapi-gradle-plugin" version "4.9.3"
}

group = 'com.rs.sample'
version = '0.0.1-SNAPSHOT'

java {
    sourceCompatibility = '20'
}

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.kafka:spring-kafka'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.kafka:spring-kafka-test'
}

tasks.named('test') {
    useJUnitPlatform()
}

// https://github.com/sngular/scs-multiapi-plugin
asyncapimodel {
    specFile {
        {
            filePath = './src/main/resources/asyncapi/sampleapi.yaml'
            consumer {
                ids = 'receiveTestMessage'
                apiPackage = 'com.rs.sample.api.model.event.consumer'
                modelPackage = 'com.rs.sample.api.model.event'
            }
            supplier {
                ids = 'receiveTestMessage'
                apiPackage = 'com.rs.sample.api.model.event.producer'
                modelPackage = 'com.rs.sample.api.model.event'
            }
        }
        overWriteModel = true
    }
}
github-actions[bot] commented 1 year ago

Thank you for collaborating with the project by giving us feedback! Cheers!

jemacineiras commented 1 year ago

HI @novaross ,

I'm gonna take a look at it. Back to you asap.

Cheers

novaross commented 1 year ago

Hi,

The 261 branch fixes the issue, now the files are generated in the target folder. Thank you for the fast response!

Need to update the \scs-multiapi-gradle-plugin\build.gradle to use v 4.9.4 of the engine:

implementation 'com.sngular:multiapi-engine:4.9.4'