Thursday, 14 November 2013

Fixing compile error for AWS Java sample

If you are getting an error like:

~/aws-java-sample/src/main/java/com/amazonaws/samples/S3Sample.java:[94,31] error: for-each loops are not supported in -source 1.3

When trying to build the aws-java-sample from GitHub you can fix it by adding the maven compile source and target (see link). Something like:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>

Fix submitted on GitHub by mvrueden.