如何配置 Maven 来编译当前的 AWS SWF 代码
How to configure Maven to compile current AWS SWF code
对于最新版本的 AWS SDK(例如 1.11.28),我应该在 pom.xml 中放入什么以便 Maven 可以编织和编译所有内容?这个主题在几个地方都有讨论,但我能找到的所有答案都是多年以前的,而且我只能让它们适用于旧版本的 AWS SDK,如果有的话。
How to consume Amazon SWF
<-- 这对 AWS 1.3.3 有一个可靠的答案,其中一个答案暗示为 1.9.x,但那仍然有年头了。
http://www.ana-todor.ro/using-the-aws-flow-java-framework-with-intellij-idea-and-maven/ <-- 这很有魅力,但只适用于 AWS 1.7 和旧版本的 AspectJ
经过多次谷歌搜索、阅读、思考、反复试验和咬牙切齿后,我现在有了一个 POM,它成功地为 AWS SDK 1.11.35 版编译了基于 SWF 的应用程序(我将其与 Java 1.7,顺便说一句)。获得恰到好处的版本号并不是那么重要,更多的是获得正确的组件名称(显然亚马逊近年来不止一次改变了他们的 SDK 的组织方式)。所以这里是:
<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>groupid</groupId>
<artifactId>myproj</artifactId>
<version>1.01</version>
<name>MyProjName</name>
<properties>
<target.dir>target</target.dir>
<annotations.dir>${target.dir}/generated-sources/annotations</annotations.dir>
<aws.version>1.11.35</aws.version>
<flow.tools.name>aws-swf-build-tools</flow.tools.name>
<flow.tools.version>1.0</flow.tools.version>
<freemarker.version>2.3.25-incubating</freemarker.version>
<aspectj-runtime.version>1.7.4</aspectj-runtime.version>
<aspectj-maven-plugin.version>1.8</aspectj-maven-plugin.version>
<compliance.level>1.7</compliance.level>
</properties>
<dependencies>
<!-- dependencies for AWS Flow -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>${flow.tools.name}</artifactId>
<version>${flow.tools.version}</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
<!-- Dependencies for preprocessing SWF's @annotations: -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj-runtime.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Use a standalone annotation processor -->
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${annotations.dir}</outputDirectory>
<processor>
com.amazonaws.eclipse.simpleworkflow.asynchrony.annotationprocessor.AsynchronyDeciderAnnotationProcessor
</processor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>${flow.tools.name}</artifactId>
<version>${flow.tools.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
</plugin>
<!-- Tell Maven NOT to do any annotation processing: -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<compilerArgument>-proc:none</compilerArgument>
<compilerArguments>
<Xmaxerrs>5</Xmaxerrs>
</compilerArguments>
<source>${compliance.level}</source>
<target>${compliance.level}</target>
</configuration>
</plugin>
<!-- Enable weaving via AspectJ: -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj-maven-plugin.version}</version>
<dependencies>
<!-- Include this in order to keep aspectjrt consistent across all dependencies: -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj-runtime.version}</version>
</dependency>
</dependencies>
<configuration>
<complianceLevel>${compliance.level}</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<source>${compliance.level}</source>
<target>${compliance.level}</target>
<aspectLibraries>
<aspectLibrary>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
</aspectLibrary>
<aspectLibrary>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-swf-libraries</artifactId>
</aspectLibrary>
</aspectLibraries>
<sources>
<source>
<basedir>${annotations.dir}</basedir>
</source>
<source>
<basedir>src/main/java</basedir>
</source>
</sources>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal> <!-- use this goal to weave all your main classes -->
<goal>test-compile</goal> <!-- use this goal to weave all your test classes -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
对于最新版本的 AWS SDK(例如 1.11.28),我应该在 pom.xml 中放入什么以便 Maven 可以编织和编译所有内容?这个主题在几个地方都有讨论,但我能找到的所有答案都是多年以前的,而且我只能让它们适用于旧版本的 AWS SDK,如果有的话。
How to consume Amazon SWF <-- 这对 AWS 1.3.3 有一个可靠的答案,其中一个答案暗示为 1.9.x,但那仍然有年头了。
http://www.ana-todor.ro/using-the-aws-flow-java-framework-with-intellij-idea-and-maven/ <-- 这很有魅力,但只适用于 AWS 1.7 和旧版本的 AspectJ
经过多次谷歌搜索、阅读、思考、反复试验和咬牙切齿后,我现在有了一个 POM,它成功地为 AWS SDK 1.11.35 版编译了基于 SWF 的应用程序(我将其与 Java 1.7,顺便说一句)。获得恰到好处的版本号并不是那么重要,更多的是获得正确的组件名称(显然亚马逊近年来不止一次改变了他们的 SDK 的组织方式)。所以这里是:
<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>groupid</groupId>
<artifactId>myproj</artifactId>
<version>1.01</version>
<name>MyProjName</name>
<properties>
<target.dir>target</target.dir>
<annotations.dir>${target.dir}/generated-sources/annotations</annotations.dir>
<aws.version>1.11.35</aws.version>
<flow.tools.name>aws-swf-build-tools</flow.tools.name>
<flow.tools.version>1.0</flow.tools.version>
<freemarker.version>2.3.25-incubating</freemarker.version>
<aspectj-runtime.version>1.7.4</aspectj-runtime.version>
<aspectj-maven-plugin.version>1.8</aspectj-maven-plugin.version>
<compliance.level>1.7</compliance.level>
</properties>
<dependencies>
<!-- dependencies for AWS Flow -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>${flow.tools.name}</artifactId>
<version>${flow.tools.version}</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
<!-- Dependencies for preprocessing SWF's @annotations: -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj-runtime.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Use a standalone annotation processor -->
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${annotations.dir}</outputDirectory>
<processor>
com.amazonaws.eclipse.simpleworkflow.asynchrony.annotationprocessor.AsynchronyDeciderAnnotationProcessor
</processor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>${flow.tools.name}</artifactId>
<version>${flow.tools.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
</plugin>
<!-- Tell Maven NOT to do any annotation processing: -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<compilerArgument>-proc:none</compilerArgument>
<compilerArguments>
<Xmaxerrs>5</Xmaxerrs>
</compilerArguments>
<source>${compliance.level}</source>
<target>${compliance.level}</target>
</configuration>
</plugin>
<!-- Enable weaving via AspectJ: -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj-maven-plugin.version}</version>
<dependencies>
<!-- Include this in order to keep aspectjrt consistent across all dependencies: -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj-runtime.version}</version>
</dependency>
</dependencies>
<configuration>
<complianceLevel>${compliance.level}</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<source>${compliance.level}</source>
<target>${compliance.level}</target>
<aspectLibraries>
<aspectLibrary>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
</aspectLibrary>
<aspectLibrary>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-swf-libraries</artifactId>
</aspectLibrary>
</aspectLibraries>
<sources>
<source>
<basedir>${annotations.dir}</basedir>
</source>
<source>
<basedir>src/main/java</basedir>
</source>
</sources>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal> <!-- use this goal to weave all your main classes -->
<goal>test-compile</goal> <!-- use this goal to weave all your test classes -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>