AWS Dev env setup with Gradle

The = operator invokes the set<Field> method in Groovy. This is the reason why the classpath of the runDynamoDB task only contains a single file. You should use the classpath(Object... paths) which appends to the classpath:

Change the line to the following example to add the file to the default classpath:

classpath files(...) // without =

It’s the same principle as for the systemProperty entry, which also appends to the previous collection of system properties.


Please note, that your build script violates a lot of Gradle conventions and contains some problems, which may cause errors in the future:

  • Your println statements won’t be executed when the respective tasks run, but when they are configured (regardless whether the task will run or not). You need to use doFirst and doLast closures.
  • You should add your local file dependencies to your build script (in the dependencies section) and use a Gradle configuration to build your classpath instead of collecting the files and their paths on your own.

Leave a Comment