我正在尝试我们的Amazon 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开发工具包v1.11和JDK 1.8。您是否尝试将AWS开发工具包升级到2.0,或将JDK降级到1.6?
查看官方文档:
来自SDK 1.1:https://github.com/aws/aws-sdk-java/blob/master/README.md
要运行SDK,您需要Java 1.6+。有关SDK的要求和最佳设置的更多信息,请参见开发人员指南的Installing a Java Development Environment部分。
来自SDK 2.0:https://github.com/aws/aws-sdk-java-v2/blob/master/README.md
要运行SDK,您需要Java 1.8+。有关SDK的要求和最佳设置的更多信息,请参见开发人员指南的Installing a Java Development Environment部分。
此外,AWS recommends用于指定/包括各个模块的BOM方法:
指定各个SDK模块(推荐)要选择单个SDK模块,请使用适用于Maven的AWS开发工具包Java物料清单(BOM)。这样可以确保您指定的模块使用相同版本的SDK,并且彼此兼容。
<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