Référence: http://docs.aws.amazon.com/codebuild/latest/userguide/getting-started.html
rien de spécial
bash:Paramètres variables:
DIR_WORK="${HOME}/src-codebuild-demo-java"
bash:commander:
mkdir -p ${DIR_WORK}/src/{main,test}/java \
&& cd ${DIR_WORK}/
bash:commander:
FILE_INPUT='src/main/java/MessageUtil.java'
bash:commander:
cat << EOF > ${FILE_INPUT}
public class MessageUtil {
private String message;
public MessageUtil(String message) {
this.message = message;
}
public String printMessage() {
System.out.println(message);
return message;
}
public String salutationMessage() {
message = "Hi!" + message;
System.out.println(message);
return message;
}
}
EOF
cat ${FILE_INPUT}
bash:commander:
FILE_INPUT='src/test/java/TestMessageUtil.java'
bash:commander:
cat << EOF > ${FILE_INPUT}
import org.junit.Test;
import org.junit.Ignore;
import static org.junit.Assert.assertEquals;
public class TestMessageUtil {
String message = "Robert";
MessageUtil messageUtil = new MessageUtil(message);
@Test
public void testPrintMessage() {
System.out.println("Inside testPrintMessage()");
assertEquals(message,messageUtil.printMessage());
}
@Test
public void testSalutationMessage() {
System.out.println("Inside testSalutationMessage()");
message = "Hi!" + "Robert";
assertEquals(message,messageUtil.salutationMessage());
}
}
EOF
cat ${FILE_INPUT}
bash:commander:
FILE_INPUT='pom.xml'
bash:commander:
cat << EOF > ${FILE_INPUT}
<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>org.example</groupId>
<artifactId>messageUtil</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>Message Utility Java Sample App</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
EOF
cat ${FILE_INPUT}
bash:commander:
xmllint --noout ${FILE_INPUT}
Si rien ne s'affiche, c'est OK.
bash:commander:
git init
bash:Paramètres variables:
GIT_ADDR='<adresse mail>'
bash:commander:
git config --global user.email "${GIT_ADDR}"
bash:Paramètres variables:
GIT_NAME='Your Name'
bash:commander:
git config --global user.name "${GIT_NAME}"
bash:commander:
git add .
bash:commander:
git commit -m 'created repository.'
bash:commander:
git log
Résultat (exemple):
commit 95d8522773831827702fe9841aff4c33acb7f514
Author: Your Name <[email protected]>
Date: Sun Apr 17 12:38:37 2017 +0000
created repository.
Recommended Posts