Skip to content

Improve Building from Source Instructions #2257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/next-release/feature-AWSSDKforJavav2-edd67d8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "feature",
"category": "AWS SDK for Java v2",
"description": "Improve Building from Source Instructions",
"contributor": "helloworldless"
}
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this info in the archetype-lambda README instead of the main README?
https://github.com/aws/aws-sdk-java-v2/blob/master/archetypes/archetype-lambda/README.md


### 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid giving super specific instructions on menu paths because they can vary - for example, in my IntelliJ the Build, Execution, Deployment menu is not under File | Settings but under Preferences.

Maybe just mention Build, Execution, Deployment | Build Tools | Maven | Importing? Or maybe instruct to search Build Tools in the Search tool.

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:

Expand Down