Alexa SkillをJAVAで作る際の初期設定方法(Cloud9)

アレクサのスキルをジャバで作ってみたので備忘録を残しておきます。
環境はAWSのCloud9を使っています。

[Cloud9]
１）
```sudo yum -y update```

2)
```sudo yum -y install java-1.8.0-openjdk-devel```

3)
```sudo update-alternatives --config java
sudo update-alternatives --config javac
```
4)
```java -version
javac -version
```
5)
```mvn -version```

6)
```sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven```

7)
```mvn -version```

8)赤字は変更する
```mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false```

*-DgroupId={group-id}
*-DartifactId={project-name}

e.g)上記の場合、
"my-app
  |- src
  |   `- main
  |        `- java
  |             `- com
  |                 `- mycompany
  |                      `- app
  |                          `-App.java
  |- test
  |   `- java
  |        `- com
  |            `- mycompany
  |                 `- app
  |                     `- AppTest.java
  `- pom.xml"


■アレクサ用pom.xml
"<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/maven-v4_0_0.xsd"">
  <modelVersion>4.0.0</modelVersion>
  <groupId>alexa-skills-kit-samples</groupId>
  <artifactId>colorpicker</artifactId>
  <packaging>jar</packaging>
  <version>1.0</version>
  <name>colorpicker</name>
  <url>http://developer.amazon.com/ask</url>
  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Alexa Skills Kit</name>
      <email>ask-sdk-java@amazon.com</email>
      <organization>Alexa</organization>
      <organizationUrl>http://developer.amazon.com/ask</organizationUrl>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:https://github.com/amzn/alexa-skills-kit-java.git</connection>
    <developerConnection>scm:git:https://github.com/amzn/alexa-skills-kit-java.git</developerConnection>
    <url>https://github.com/amzn/alexa-skills-kit-java.git</url>
  </scm>

  <dependencies>
    <dependency>
      <groupId>com.amazon.alexa</groupId>
      <artifactId>ask-sdk</artifactId>
      <version>2.12.0</version>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.7.0</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <forceJavacCompilerUse>true</forceJavacCompilerUse>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  
</project>
"

9)下記マニュアルに沿って作成
https://alexa-skills-kit-sdk-for-java.readthedocs.io/ja/latest/Developing-Your-First-Skill.html

```mvn org.apache.maven.plugins:maven-assembly-plugin:2.6:assembly -DdescriptorId=jar-with-dependencies package```

10)tarファイルをラムダへアップロード
「with-dependencies」のファイル

11）関数コードのハンドラーに以下を入れる
```com.amazon.ask.onseisuijaku.OnseiSuijakuStreamHandler```

完了