1## Working on the SDK 2 3### Things to Know 4* The SDK is built on Java 8 5* [Maven][maven] is used as the build and dependency management system 6* The majority of the service client code is auto-generated using the [code 7 generator][codegen] 8 9### Development Environment Setup Tips 10If you use IntelliJ IDEA, the following config files will be used by default for your project-level settings: 11 12- [Copyright](https://raw.githubusercontent.com/aws/aws-sdk-java-v2/master/.idea/copyright/AWS_Java_SDK_2_0.xml) 13 14 This automatically inserts the license header to the top of source files that you create. 15 16- [Code style](https://raw.githubusercontent.com/aws/aws-sdk-java-v2/master/.idea/codeStyles/Project.xml) 17 18 This will help ensure your code follows our code style guidelines. 19 20- [Inspections](https://raw.githubusercontent.com/aws/aws-sdk-java-v2/master/.idea/inspectionProfiles/AWS_Java_SDK_2_0.xml) 21 22 This will help ensure your code is correct and follows our best practices. Please ensure your changes do not generate any new inspection warnings. 23 24If you have Checkstyle integrated with your IDE, we also recommend 25configuring it with our 26[Checkstyle config](https://raw.githubusercontent.com/aws/aws-sdk-java-v2/master/build-tools/src/main/resources/software/amazon/awssdk/checkstyle.xml) 27so you can see any violations in line with the code. 28 29### Building 30Since the SDK is a normal Maven project, the usual `mvn package` and `mvn 31install` commands are all you need to build the SDK. 32 33One important thing to note is that if you're working on the [code 34generator][codegen], be sure to do a `mvn install` rather than a phase that 35comes earlier such as `compile` or `test` so that the build uses the 36correct code generator JAR (i.e. the one including your changes). When in 37doubt, just use `mvn package`. 38 39#### Disabling Checkstyle/FindBugs 40Normally Checkstyle and FindBugs scans run as part of the build process. 41However, this slows down the build significantly so if you need to be able to 42iterate quickly locally, you can turn either of them off by setting the 43appropriate properties: 44 45```sh 46# skips both Checkstyle and FindBugs 47$ mvn install -Dfindbugs.skip=true -Dcheckstyle.skip=true 48``` 49 50### Testing 51#### Unit Tests 52As described in the project structure, tests are split between unit and 53integration tests. During the normal `test` lifecycle phase, only the unit 54tests are run. 55 56```sh 57# runs the unit tests 58mvn install 59``` 60 61### Integration Tests 62__Before running the integration tests, be aware that they require active AWS 63IAM credentials, and because they will make actual calls to AWS, will incur a 64cost to the owner of the account.__ 65 66If you're writing an integration test, try to see if it's possible to write it 67as a set of unit tests with mocked responses instead. 68 69#### Test Credentials 70 71As mentioned above, you will need to have active IAM credentials that the tests 72will use to authenticate with AWS, and it will need to have an attached IAM 73policy that is allowed to perform the actions the tests will be running. 74 75All integration tests are written to locate these credentials in 76`$HOME/.aws/awsTestAccount.properties`: 77 78``` 79$ cat $HOME/.aws/awsTestAccount.properties 80 81accessKey = ... 82secretKey = ... 83``` 84 85#### Running the Integration Tests 86 87In order to run the integration tests along with the unit tests, you must 88activate the `integration-tests` profile 89 90```sh 91# runs both unit and integration tests 92mvn install -P integration-tests 93``` 94 95[maven]: https://maven.apache.org/ 96[codegen]: https://github.com/aws/aws-sdk-java-v2/blob/master/codegen 97