Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java jsonschematoPojo与自定义注释渐变生成问题_Java_Gradle - Fatal编程技术网

Java jsonschematoPojo与自定义注释渐变生成问题

Java jsonschematoPojo与自定义注释渐变生成问题,java,gradle,Java,Gradle,我正在使用jsonschema2pojo插件为项目a生成POJO,它需要项目B(实用程序项目)中的自定义注释,如下所示: A(使用jsonschema2pojo插件的pojo生成器,依赖B生成B(具有自定义注释生成器的实用程序项目)自定义注释) A(build.gradle) 当我构建时,它失败了,因为它无法识别自定义注释 如何解决这个问题?我尝试了这条线的所有味道,但还是没有运气- description = "Domain Model" buildscri

我正在使用jsonschema2pojo插件为项目a生成POJO,它需要项目B(实用程序项目)中的自定义注释,如下所示:

A(使用jsonschema2pojo插件的pojo生成器,依赖B生成B(具有自定义注释生成器的实用程序项目)自定义注释)

A(build.gradle)

当我构建时,它失败了,因为它无法识别自定义注释

如何解决这个问题?我尝试了这条线的所有味道,但还是没有运气-

    description = "Domain Model"
    buildscript {
        ext {
            js2pVersion='1.0.2'
            jacksonVersion='2.10.2'
            validationAPI = '2.0.0.Final'
        }
        repositories {
            mavenCentral()
            mavenLocal()
        }
        dependencies {
            classpath ("org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:${js2pVersion}")
                    { exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind' }
            classpath ("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}")
            **classpath ("myworld:B:0.1-SNAPSHOT")**
        }
    }
    
    apply plugin: 'java-library'
    apply plugin: 'maven-publish'
    apply plugin: 'jsonschema2pojo'
    
    group 'myworld'
    version = "${version != 'unspecified' ? version : '0.1-SNAPSHOT'}"
    
    task sourceJar(type: Jar, dependsOn: classes) {
        from sourceSets.main.allSource
        archiveClassifier = 'sources'
    }
    
    repositories {
        mavenCentral()
        mavenLocal()
    }
    
    publishing {
        publications {
            mavenJava(MavenPublication) {
                groupId = group
                version = version
                from components.java
                artifact sourceJar
            }
        }
    
        repositories {
            maven {
                def releasesRepoUrl = nexusUrl + "/repositories/releases/"
                def snapshotsRepoUrl = nexusUrl + "/repositories/snapshots/"
                url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
                credentials {
                    username nexusUsername
                    password nexusPassword
                }
            }
        }
    }
    
    dependencies {
        api project(':B')
    
        compileOnly ("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}")
        compileOnly ("javax.validation:validation-api:${validationAPI}")
    }
    
    jsonSchema2Pojo {
        includeAdditionalProperties = true
        generateBuilders = true
        source = files("${sourceSets.main.resources.srcDirs[0]}/schema")
        targetDirectory = file("${sourceSets.main.java.srcDirs[0]}/")
        targetPackage = 'myworkld.model'
        **customAnnotator = 'myworld.model.generator.ValueOfEnumAnnotator'**
        propertyWordDelimiters = ["_","-"] as char[]
        useLongIntegers = true
        useBigDecimals = true
        includeHashcodeAndEquals = true
        includeToString = true
        annotationStyle = 'jackson2'
        includeJsr303Annotations = true
        includeConstructors = true
        sourceType = 'jsonschema'
        removeOldOutput = true
        outputEncoding = 'UTF-8'
        initializeCollections = true
        serializable = true
        includeDynamicAccessors = true
        dateType = 'java.time.LocalDate'
        dateTimeType = 'java.time.LocalDateTime'
    }
    
    clean {
        

    delete "src/main/java"
    }