aws-iot-builder-tools / aws-greengrass-provisioner

Simplifies provisioning Greengrass Cores and building Greengrass Lambda functions
Apache License 2.0
54 stars 15 forks source link

Document provisioner usage with maven based functions #32

Open Sandmania opened 5 years ago

Sandmania commented 5 years ago

Currently it is not immediately clear how the provisioner should be used with maven based functions. Looking at BasicMavenBuilder, it seems to be very opinionated but gives little information in the way of javadocs or other documentation.

I'm sure we can live with the hard coded values for now, but it should be clear what files are expected where. Maybe just a simple sample directory structure with explanations?

.
├── deployments
│   ├── deployment.defaults.conf
│   ├── function.defaults.conf
│   └── my-function.conf
├── foundation
│   ├── 1-I-wonder
│   ├── 2-what-should
│   └── 3-be-here
└── functions
    └── my-function
        └── function.conf
Sandmania commented 5 years ago

Some more observations:

FOUNDATION_GREENGRASS_JAVA_SDK_1_2_JAR = "/foundation/GreengrassJavaSDK-1.2.jar.zip" is defined in BasicMavenBuilder but actually GreengrassJavaSDK-1.3.jar.zip is under foundation.

I'm running this without the docker container, so directly with java -jar ..... I'm wondering if the paths are now a bit messed up, as the executable jar is under build/libs/ and the zip in build/foundation/

And the actual error I'm getting when running java -jar ../GGP/aws-greengrass-provisioner/build/libs/AwsGreengrassProvisioner.jar -a ARM32 -g test -d deployments/test.conf --script is

[ERROR] BasicMavenBuilder: Parallel task execution failed [java.lang.IllegalArgumentException: resource /foundation/GreengrassJavaSDK-1.3.jar.zip not found.]
[ERROR] AwsGreengrassProvisioner: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: resource /foundation/GreengrassJavaSDK-1.3.jar.zip not found.
timmattison commented 5 years ago

I switched from Maven to Gradle to simplify a few tasks and a casualty of this was that the Maven builder has been neglected. I’ll take a look.

Do you have any functions you want to deploy so I can take a look?

Sandmania commented 5 years ago

Just edited my previous comment with the actual error I'm experiencing. I'm pretty confident that at this point it does not actually have anything to do with the function. When I get this up and running I can do a PR for a mavenized and delomboked CDDSkeleton.

timmattison commented 5 years ago

CDDSkeleton used to be Maven project but I converted to Gradle since it was easier to include the CDD framework (in my opinion). But I would like to see what you put together and consider what makes more sense. Delomboked would be great. I'm always looking for ways to reduce my dependence on Lombok since it breaks some things (like Dagger, which I've also started ditching for other reasons).

timmattison commented 5 years ago

BTW, the project was delomboked today.