vikkyhacks
vikkyhacks

Reputation: 3230

Autogenerated code in amazon swf flow framework throws syntax error

I am trying our amazon's SWF flow framework, but I am getting the below error and the project does not compile. I am using maven for my dependency management and I'm running my code from Intellij.

[INFO] -------------------------------------------------------------
[ERROR] /home/meow/Arena/github/ProjectX/AWS/target/generated-sources/annotations/aws/swf/B_FlowFramework/B_WithAWSFlow/EditImageActivityClient.java:[24,18] <identifier> expected
[ERROR] /home/meow/Arena/github/ProjectX/AWS/target/generated-sources/annotations/aws/swf/B_FlowFramework/B_WithAWSFlow/EditImageActivityClient.java:[24,19] = expected
[ERROR] /home/meow/Arena/github/ProjectX/AWS/target/generated-sources/annotations/aws/swf/B_FlowFramework/B_WithAWSFlow/EditImageActivityClient.java:[24,25] illegal start of type
[ERROR] /home/meow/Arena/github/ProjectX/AWS/target/generated-sources/annotations/aws/swf/B_FlowFramework/B_WithAWSFlow/EditImageActivityClient.java:[29,18] <identifier> expected
[ERROR] /home/meow/Arena/github/ProjectX/AWS/target/generated-sources/annotations/aws/swf/B_FlowFramework/B_WithAWSFlow/EditImageActivityClient.java:[29,19] = expected

From Intellij, I've already confirmed if annotation processing is enabled from Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable Annotation Processing

The codebase is on GitHub and its entry point is at https://github.com/vikkyhacks/ProjectX/blob/master/AWS/src/main/java/aws/swf/B_FlowFramework/B_WithAWSFlow/WorkflowStarter.java

Also adding pom.xml for easy reference,

<?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>vikkyhacks.projectX.aws</groupId>
    <artifactId>AWS</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-swf-build-tools</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-dynamodb</artifactId>
            <version>1.11.635</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-iam</artifactId>
            <version>1.11.635</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-sqs</artifactId>
            <version>1.11.635</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.10</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Upvotes: 3

Views: 266

Answers (1)

Fabio Manzano
Fabio Manzano

Reputation: 2865

It might be because you are using AWS SDK v1.11 and JDK 1.8. Did you try to upgrade AWS SDK to 2.0, or downgrade JDK to 1.6?

Check official documentation:

From SDK 1.1: https://github.com/aws/aws-sdk-java/blob/master/README.md

To run the SDK you will need Java 1.6+. For more information about the requirements and optimum settings for the SDK, please see the Installing a Java Development Environment section of the developer guide.

From SDK 2.0: https://github.com/aws/aws-sdk-java-v2/blob/master/README.md

To run the SDK you will need Java 1.8+. For more information about the requirements and optimum settings for the SDK, please see the Installing a Java Development Environment section of the developer guide.

Also, AWS recommends the BOM method for specifying/including individual modules:

Specifying Individual SDK Modules (Recommended) To select individual SDK modules, use the AWS SDK for Java bill of materials (BOM) for Maven. This ensures that the modules you specify use the same version of the SDK, and that they're compatible with each other.

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>software.amazon.awssdk</groupId>
      <artifactId>bom</artifactId>
      <version>2.X.X</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

And an example for Kinesis and DynamoDB:

<dependencies>
  <dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>kinesis</artifactId>
  </dependency>
  <dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>dynamodb</artifactId>
  </dependency>
</dependencies>

Note: for SWF, try artifactId as swf. Full list: https://search.maven.org/search?q=g:software.amazon.awssdk

Upvotes: 0

Related Questions