Create a project
Build Your First Origin Repository
Create a project
Create the local project that you will turn into a Divekit origin repository in the next lesson.
Build the starter project
Step 1: create or enter the project folder
If you do not already have a project folder, create one:
mkdir vehicle-workshop
cd vehicle-workshop
If you already created that directory earlier, just enter it.
Step 2: add a tiny template file
Now add a tiny template file so your project already contains content that can later be individualized.
Create the source folder:
mkdir -p src
Create src/$Vehicle$.java with the following content — the easiest way is your editor, because the file name itself contains the placeholder:
public class $Vehicle$ {
public String kind() {
return "$Vehicle$";
}
}
If you prefer to create the file in the terminal, put the name in single quotes so your shell does not interpret $Vehicle$ as a variable:
touch 'src/$Vehicle$.java'
Also create a README.md:
# Vehicle Workshop
This assignment contains one placeholder: `$Vehicle$`.
At this point, this is still just a normal project folder with starter files.
Common failures
Your shell expanded the placeholder. In bash and zsh, an unquoted $Vehicle is read as a (probably empty) shell variable, so touch src/$Vehicle$.java actually creates src/$.java.
Delete the wrong file and recreate it with the name in single quotes:
rm 'src/$.java'
touch 'src/$Vehicle$.java'
The same applies to the file content: if you write it with a heredoc, quote the delimiter (<<'EOF'), otherwise the placeholders inside the file are mangled too. When in doubt, use your editor.
Check
Before moving on, make sure you can answer these questions:
src/$Vehicle$.java, inside that file as the class name and return value, and in the README.md.
Vehicle may be replaced.
divekit init in the next lesson.