-
Notifications
You must be signed in to change notification settings - Fork 910
[Bug bash] Include sso and ssooidc dependencies in maven archetype #3767
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
Changes from 1 commit
cb02f12
89790e4
b172b05
20993fc
227a6da
e6327eb
973d26e
39856f8
0385696
24d6bb4
b0b6603
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
groupId=software.amazonaws.test | ||
artifactId=test-apache-artifact | ||
version=1.0-SNAPSHOT | ||
package=software.amazonaws.test | ||
service=s3 | ||
httpClient=apache-client | ||
javaSdkVersion=2.11.0 | ||
nativeImage=true | ||
ssoIdc=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
verify |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# App | ||
|
||
This project contains a maven application with [AWS Java SDK 2.x](https://github.com/aws/aws-sdk-java-v2) dependencies. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we say that it's using SSO/SSOOIDC or are the other projects also generic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't specify which individual dependencies that are included for other property of the archetype, so I think we should leave it as-is |
||
|
||
## Prerequisites | ||
- Java 1.8+ | ||
- Apache Maven | ||
- GraalVM Native Image (optional) | ||
|
||
## Development | ||
|
||
Below is the structure of the generated project. | ||
|
||
``` | ||
├── src | ||
│ ├── main | ||
│ │ ├── java | ||
│ │ │ └── package | ||
│ │ │ ├── App.java | ||
│ │ │ ├── DependencyFactory.java | ||
│ │ │ └── Handler.java | ||
│ │ └── resources | ||
│ │ └── simplelogger.properties | ||
│ └── test | ||
│ └── java | ||
│ └── package | ||
│ └── HandlerTest.java | ||
``` | ||
|
||
- `App.java`: main entry of the application | ||
- `DependencyFactory.java`: creates the SDK client | ||
- `Handler.java`: you can invoke the api calls using the SDK client here. | ||
|
||
#### Building the project | ||
``` | ||
mvn clean package | ||
``` | ||
|
||
#### Building the native image | ||
|
||
Note that it requires `native-image` installed in your environment | ||
|
||
``` | ||
mvn clean package -P native-image | ||
``` | ||
After it finishes, you can find the generated native image in the `target | ||
` folder. | ||
|
||
You can run the following command to execute it. | ||
|
||
``` | ||
target/test-apache-artifact | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>software.amazonaws.test</groupId> | ||
<artifactId>test-apache-artifact</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<maven.shade.plugin.version>3.2.1</maven.shade.plugin.version> | ||
<maven.compiler.plugin.version>3.6.1</maven.compiler.plugin.version> | ||
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version> | ||
<aws.java.sdk.version>2.11.0</aws.java.sdk.version> | ||
<slf4j.version>1.7.28</slf4j.version> | ||
<graalvm.native.maven.plugin.version>0.9.6</graalvm.native.maven.plugin.version> | ||
<junit5.version>5.8.1</junit5.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>bom</artifactId> | ||
<version>${aws.java.sdk.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>s3</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>netty-nio-client</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>apache-client</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>sso</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>ssooidc</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>apache-client</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>commons-logging</groupId> | ||
<artifactId>commons-logging</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
|
||
<!-- Needed to adapt Apache Commons Logging used by Apache HTTP Client to Slf4j to avoid | ||
ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl during runtime --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>jcl-over-slf4j</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
|
||
<!-- Test Dependencies --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>${junit5.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven.compiler.plugin.version}</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>native-image</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.graalvm.buildtools</groupId> | ||
<artifactId>native-maven-plugin</artifactId> | ||
<version>${graalvm.native.maven.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>build-native</id> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
<phase>package</phase> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<imageName>test-apache-artifact</imageName> | ||
<mainClass>software.amazonaws.test.App</mainClass> | ||
<buildArgs combine.children="append"> | ||
<buildArgs> | ||
--verbose | ||
--no-fallback | ||
--initialize-at-build-time=org.slf4j | ||
</buildArgs> | ||
</buildArgs> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package software.amazonaws.test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class App { | ||
private static final Logger logger = LoggerFactory.getLogger(App.class); | ||
|
||
public static void main(String... args) { | ||
logger.info("Application starts"); | ||
|
||
Handler handler = new Handler(); | ||
handler.sendRequest(); | ||
|
||
logger.info("Application ends"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
package software.amazonaws.test; | ||
|
||
import software.amazon.awssdk.http.apache.ApacheHttpClient; | ||
import software.amazon.awssdk.services.s3.S3Client; | ||
|
||
/** | ||
* The module containing all dependencies required by the {@link Handler}. | ||
*/ | ||
public class DependencyFactory { | ||
|
||
private DependencyFactory() {} | ||
|
||
/** | ||
* @return an instance of S3Client | ||
*/ | ||
public static S3Client s3Client() { | ||
return S3Client.builder() | ||
.httpClientBuilder(ApacheHttpClient.builder()) | ||
.build(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package software.amazonaws.test; | ||
|
||
import software.amazon.awssdk.services.s3.S3Client; | ||
|
||
|
||
public class Handler { | ||
private final S3Client s3Client; | ||
|
||
public Handler() { | ||
s3Client = DependencyFactory.s3Client(); | ||
} | ||
|
||
public void sendRequest() { | ||
// TODO: invoking the api calls using s3Client. | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SLF4J's SimpleLogger configuration file | ||
# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. | ||
|
||
# Default logging detail level for all instances of SimpleLogger. | ||
# Must be one of ("trace", "debug", "info", "warn", or "error"). | ||
# If not specified, defaults to "info". | ||
org.slf4j.simpleLogger.defaultLogLevel=info | ||
|
||
# Log SDK requests | ||
org.slf4j.simpleLogger.log.software.amazon.awssdk.request=debug | ||
org.slf4j.simpleLogger.showDateTime=true | ||
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z | ||
|
||
# Set to true if you want to output the current thread name. | ||
# Defaults to true. | ||
org.slf4j.simpleLogger.showThreadName=true | ||
|
||
# Set to true if you want the Logger instance name to be included in output messages. | ||
# Defaults to true. | ||
#org.slf4j.simpleLogger.showLogName=true | ||
|
||
# Set to true if you want the last component of the name to be included in output messages. | ||
# Defaults to false. | ||
org.slf4j.simpleLogger.showShortLogName=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package software.amazonaws.test; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class HandlerTest { | ||
//TODO add tests here | ||
} |
Uh oh!
There was an error while loading. Please reload this page.