How to compile generated source


(Felix Gao) #1

I have the following in my build.gradle file def generatedResources = “$buildDir/generated-sources/main”

sourceSets {

main {

output.dir(generatedResources)

} }

18:17:36.077 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :generateProto UP-TO-DATE 18:17:36.083 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :compileJava 18:17:36.084 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ‘:compileJava’ 18:17:36.164 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Determining if task ‘:compileJava’ is up-to-date 18:17:36.170 [DEBUG] [org.gradle.api.internal.changedetection.DefaultFileCacheListener] Can cache files for configuration ‘:compile’ 18:17:36.171 [DEBUG] [org.gradle.api.internal.changedetection.DefaultFileCacheListener] Can cache files for directory ‘/Users/felixgao/projects/git_bk_proto/src/main/java’ 18:17:36.172 [DEBUG] [org.gradle.api.internal.changedetection.DefaultFileCacheListener] Can cache files for directory ‘/Users/felixgao/projects/git_bk_proto/build/generated-sources/main’ 18:17:36.176 [DEBUG] [org.gradle.api.internal.changedetection.DefaultFileCacheListener] Can cache files for file ‘/Users/felixgao/projects/git_bk_proto/build/classes/main’ 18:17:36.178 [DEBUG] [org.gradle.api.internal.changedetection.DefaultFileCacheListener] Can cache files for file ‘/Users/felixgao/projects/git_bk_proto/build/dependency-cache’ 18:17:36.251 [INFO] [org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository] Skipping task ‘:compileJava’ as it is up-to-date. 18:17:36.252 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Skipping task ‘:compileJava’ as it is up-to-date 18:17:36.253 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:compileJava’ 18:17:36.260 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :compileJava UP-TO-DATE 18:17:36.261 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskGraphExecuter] Timing: Executing the DAG took 0.464 secs 18:17:36.263 [LIFECYCLE] [org.gradle.BuildResultLogger]

18:17:36.265 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD SUCCESSFUL 18:17:36.268 [LIFECYCLE] [org.gradle.BuildResultLogger]

18:17:36.269 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 9.977 secs

My generated source code is located at /Users/felixgao/projects/git_proto/build/generated-sources/main/com/ds/protos/StatProto.java

But only thing in the jar when I execute gradle jar is the following META-INF/ META-INF/MANIFEST.MF

How can I make my build include the sources?