javadockergradleaws-codebuild

Java/gradle project that builds locally doesn't build in AWS/CodeBuild/Docker


Sorry I can't post everything, there is a lot of code - hopefully this is ok

System: Oracle Linux 9 Java Corretto 17 Gradle 7.6

The layout of my project is

main subproject_1 subproject_2 subproject_3 subproject_4

subproject_2 depends on subproject_1

In the build.grade in project_2 I have the following

 dependencies {
    implementation project(':subproject_1')
 }

This works fine on my dev box where I have Oracle Linux 9 running in VirtualBox.

I am trying to build using AWS CodeBuild. I created a docker file which is set up just like my local box, same versions, same tools, pulls source from same repo, etc. BUT - it does not compile because when files in subproject_2 reference classes in subproject_1 get the following error. Like the jar file from subproject_1 is not in the classpath, but it is - more detail below

/codebuild/output/src1686710177/src/github.com/userdir/main_project/subproject_2/src/main/java/com/xxx/yyy/management/zzz/smdr/Data.java:29: error: package **com.xxx.common.debug** does not exist
    import **com.xxx.common.debug**.DebugLoggerIfc; 

I added code to build.grade to print out the classpath for the gradle compile tasks, which shows that the jar from subproject_1 is in the classpath.

[partial output of building subproject_2:

Classpath for subproject_2:
...
...
/codebuild/output/src1686710177/src/github.com/userdir/root_project/subproject_1/build/libs/xxx-common.jar

Why does this not work in CodeBuild using the docker file?


Solution

  • This was not due to anything CodeBuild or gradle.
    Someone on the team got overly zealous about adding things to the .gitignore file that was keeping some needed files out.

    Sorry for the fire drill.
    Thanks for your responses!

    Props to intellij for showing ignored filenames in a different color - that was the hit I needed!