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

What to try

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.

What to try
You do not need to. It is fine to prepare your first template files before initialization.
What to try
Not yet. Right now they are only source text markers inside a normal project folder.
What to try
At this stage, one tiny source file and one short README are enough.

Check

Before moving on, make sure you can answer these questions:

Suggested answer
In three places: in the file name src/$Vehicle$.java, inside that file as the class name and return value, and in the README.md.
Suggested answer
Nothing yet. They are plain text markers. They only become meaningful once you initialize Divekit and define how Vehicle may be replaced.
Suggested answer
No — it is still a normal project folder. It becomes an origin repository when you run divekit init in the next lesson.