java - amazon swf flow 框架中自动生成的代码抛出语法错误

标签 java amazon-web-services aws-sdk aws-java-sdk amazon-swf

我正在尝试我们的亚马逊 SWF 流程框架,但出现以下错误并且项目无法编译。我正在使用 Maven 进行依赖项管理,并且正在从 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

在 Intellij 中,我已经确认是否从设置 -> 构建、执行中启用了注释处理, 部署 -> 编译器 -> 注释处理器 -> 启用 注解处理

代码库位于 GitHub 上,其入口点位于 https://github.com/vikkyhacks/ProjectX/blob/master/AWS/src/main/java/aws/swf/B_FlowFramework/B_WithAWSFlow/WorkflowStarter.java

同时添加pom.xml方便引用,

<?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>

最佳答案

这可能是因为您使用的是 AWS SDK v1.11 和 JDK 1.8。您是否尝试将 AWS SDK 升级到 2.0,或将 JDK 降级到 1.6?

查看官方文档:

来自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.

来自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.

此外,AWS recommends用于指定/包含单个模块的 BOM 方法:

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>

以及 Kinesis 和 DynamoDB 的示例:

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

注意:对于 SWF,请尝试将 artifactId 作为 swf。完整列表:https://search.maven.org/search?q=g:software.amazon.awssdk

关于java - amazon swf flow 框架中自动生成的代码抛出语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58047444/

相关文章:

java - 使用正则表达式在节内的组件内搜索数字

java - 在 db hibernate 中插入外键

Spring Boot DynamoDB AWS 异常

amazon-web-services - AWS API Gateway - 如何通过 CLI 或 GO aws-sdk 将方法添加到根资源?

java - phonegap 相机 API 在 android 上重新启动应用程序

java - 对象数组的初学者混淆

amazon-web-services - 如何将运动视频流存储到 S3 存储桶中?

javascript - Uint8Array 到 JavaScript 对象

amazon-web-services - 在哪里可以找到 AWS Amplify Logger 日志

amazon-web-services - AWS SQS 始终返回 1 条消息(PHP SDK)