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

1を参照してください、私は生成されたJava 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") 
    } 
} 
関連する問題