0

maven에서 gradle로 마이그레이션하는 중입니다.이 경우 gradle 자체가 잘 작동하는 것 같지만 Idea는 Immutables가 생성하는 소스 코드를 인식하지 못합니다.Intellij Idea가 생성 된 코드를 인식 할 수 있도록 Immutables 용 APT를 설정하려면 어떻게합니까?

이 글은 blog post on APT으로 읽었습니다.

더 많은 코드에 대한
/* 
* This build file was generated by the Gradle 'init' task. 
* 
* This generated file contains a commented-out sample Java project to get you started. 
* For more details take a look at the Java Quickstart chapter in the Gradle 
* user guide available at https://docs.gradle.org/4.3/userguide/tutorial_java_projects.html 
*/ 


// Apply the java plugin to add support for Java 
apply plugin: 'java-library' 
apply plugin: 'idea' 

buildscript { 
    repositories { 
     maven { 
      url 'https://d3vfm0n2cffdwd.cloudfront.net' 
     } 
     jcenter() 
    } 
    dependencies { 
     classpath 'io.spring.gradle:dependency-management-plugin:1.0.0.RELEASE' 
    } 
} 

apply plugin: 'io.spring.dependency-management' 

dependencyManagement { 
    imports { 
     mavenBom 'com.xenoterracide:platform:0.1.39-SNAPSHOT' 
    } 
} 

repositories { 
    maven { 
     url 'https://d3vfm0n2cffdwd.cloudfront.net' 
    } 
    jcenter() 
} 

configurations { 
    apt 
    aptCompile 
} 

// In this section you declare the dependencies for your production and test code 
dependencies { 
    implementation 'com.google.guava:guava' 

    aptCompile 'org.immutables:value' 
    compileOnly 'org.immutables:value' 
    apt 'org.immutables:builder' 

    // The production code uses the SLF4J logging API at compile time 
    implementation 'org.slf4j:slf4j-api' 

    // Declare the dependency for your favourite test framework you want to use in your tests. 
    // TestNG is also supported by the Gradle Test task. Just change the 
    // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add 
    // 'test.useTestNG()' to your build script. 
    testImplementation 'junit:junit' 
    testImplementation 'org.assertj:assertj-core' 
    testImplementation 'org.mockito:mockito-core' 
    testImplementation 'org.hamcrest:hamcrest-library' 
} 

compileJava { 
    options.annotationProcessorPath = configurations.aptCompile 
} 

bitbucket 나를 점점 것들의

하나를 참조 나도 생성 된 자바를 시도했습니다 내용에 따라 것은 out 디렉토리에 끝, 또는 클래스 패스에 build이다, 물론 지금까지는 이들 중 어느 것도 문제를 해결하지 못합니다.

아이디어가 생성 된 유형의 소스를 볼 수 있도록 (어떻게하면 빨간색으로 강조 표시되지 않도록)이 문제를 해결할 수 있습니까?

+1

https://stackoverflow.com/a/46035904/104891이 도움이되는지 확인하십시오. – CrazyCoder

+0

@CrazyCoder hmm ... 출력 디렉토리를 공유 할 필요가 없습니다. 컴파일 할 때 생성 된 소스를 볼 필요가 있습니다. – xenoterracide

+0

얼마 전 수정 된 관련 문제는 https://youtrack.jetbrains.com/issue/IDEA-152581을 참조하십시오. 문제가 다른 경우 https://youtrack.jetbrains.com/issues/IDEA에서 신고하십시오. – CrazyCoder

답변

2

@ CrazyCoder의 링크를 통해 해결책을 찾을 수있었습니다.

idea { 
    module { 
     sourceDirs += file("out/production/classes/generated") 
    } 
}