diff --git a/.changes/next-release/feature-AWSSDKforJavav2-edd67d8.json b/.changes/next-release/feature-AWSSDKforJavav2-edd67d8.json new file mode 100644 index 000000000000..af7388eb1f07 --- /dev/null +++ b/.changes/next-release/feature-AWSSDKforJavav2-edd67d8.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "AWS SDK for Java v2", + "description": "Improve Building from Source Instructions", + "contributor": "helloworldless" +} diff --git a/README.md b/README.md index dffdfcea0da6..bdb0a2cc2378 100644 --- a/README.md +++ b/README.md @@ -116,16 +116,51 @@ See the [Set up the AWS SDK for Java][docs-setup] section of the developer guide Once you check out the code from GitHub, you can build it using Maven. +Note: The `archetypes/archetype-lambda` project requires that you have Python 3 in your path as `python`. + +### Building a Specific Service Module + +This is the fastest option if you only need to build a certain sub-project like S3 or the DynamoDB Enhanced Client. + +```sh +# Build a specific service module; Skip tests, checkstyles, findbugs, etc +mvn clean install -pl :s3 -P quick --am +``` + +### Building the Entire Project + +Note that this can take quite a long time to complete. + ```sh +# Build the entire project mvn clean install -# Skip tests, checkstyles, findbugs, etc for quick build +# Build the entire project; Skip tests, checkstyles, findbugs, etc mvn clean install -P quick - -# Build a specific service module -mvn clean install -pl :s3 -P quick --am ``` +### Code Generation + +The SDK makes significant use of code generation which takes place at build time. During a Maven build, the +`build-helper-maven-plugin` takes care of making these additional generated source files available for compilation. + +However, your IDE may not automatically detect the generated code which can lead to class not found errors. +To fix this, you may need to instruct your IDE where to find the generated code: namely, in the +`target/generated-sources` of many of the projects in this repo. + +In IntelliJ IDEA, the default setting of "Generated sources folders: Detect automatically" +under `File | Settings | Build, Execution, Deployment | Build Tools | Maven | Importing` should suffice. +However, you may still have to force a generated sources update by opening +`View | Tool Windows | Maven` and clicking the second icon from the left: +"Generate Sources and Update Folders for All Projects". Alternatively, if there is a specific project you would like +to build and you know which projects' generated code it depends on, you can force a generated sources update just for +those projects which will be much faster that generating sources for the entire project. For example, +the DynamoDB Enhanced Client (`services-custom/dynamodb-enhanced`) depends +directly or indirectly on code generated by DynamoDB (`services/dynamodb`), SDK Core (`core/sdk-core`), +and Regions (`core/regions`). So in this case, you can just find +"AWS Java SDK :: Services :: Amazon DynamoDB", "AWS Java SDK :: SDK Core", and "AWS Java SDK :: Regions" +in the Maven toolbar, right click on each, and choose "Generate Sources and Update Folders". + ## Sample Code You can find sample code for v2 in the following places: