- The SDK is built on Java 8
- Maven is used as the build and dependency management system
- The majority of the service client code is auto-generated using the code generator
If you use IntelliJ IDEA, the following config files will be used by default for your project-level settings:
-
This automatically inserts the license header to the top of source files that you create.
-
This will help ensure your code follows our code style guidelines.
-
This will help ensure your code is correct and follows our best practices. Please ensure your changes do not generate any new inspection warnings.
If you have Checkstyle integrated with your IDE, we also recommend configuring it with our Checkstyle config so you can see any violations in line with the code.
Since the SDK is a normal Maven project, the usual mvn package
and mvn install
commands are all you need to build the SDK.
One important thing to note is that if you're working on the code
generator, be sure to do a mvn install
rather than a phase that
comes earlier such as compile
or test
so that the build uses the
correct code generator JAR (i.e. the one including your changes). When in
doubt, just use mvn package
.
Normally Checkstyle and FindBugs scans run as part of the build process. However, this slows down the build significantly so if you need to be able to iterate quickly locally, you can turn either of them off by setting the appropriate properties:
# skips both Checkstyle and FindBugs
$ mvn install -Dfindbugs.skip=true -Dcheckstyle.skip=true
As described in the project structure, tests are split between unit and
integration tests. During the normal test
lifecycle phase, only the unit
tests are run.
# runs the unit tests
mvn install
Before running the integration tests, be aware that they require active AWS IAM credentials, and because they will make actual calls to AWS, will incur a cost to the owner of the account.
If you're writing an integration test, try to see if it's possible to write it as a set of unit tests with mocked responses instead.
As mentioned above, you will need to have active IAM credentials that the tests will use to authenticate with AWS, and it will need to have an attached IAM policy that is allowed to perform the actions the tests will be running.
All integration tests are written to locate these credentials in
$HOME/.aws/awsTestAccount.properties
:
$ cat $HOME/.aws/awsTestAccount.properties
accessKey = ...
secretKey = ...
In order to run the integration tests along with the unit tests, you must
activate the integration-tests
profile
# runs both unit and integration tests
mvn install -P integration-tests