How To Use Yeoman To Scaffold Java Spring Project

Yeoman is an open source tool which can help you to create different project skeleton easily an quickly. It contains a yo command line tool and a lot of structure/template generators to create different project file skeleton( etc java project, spring boot project). This article will tell you how to use it to create a java project structure and a spring boot project structure.

1. Install Yoeman.

Yoeman contains a command line user interface( yo ) written by Node js, so we should use npm to install Yoeman as below.

  1. Open a terminal and make sure npm has been installed on your machine.
    $ npm -v
  2. Install yo with npm in the terminal. You had better install it with the root user, root user has full file permission. When the command complete, you can find yo module in folder /usr/local/lib/node_modules.
    $ sudo npm install -g yo

2. Install Structure/Template Generators.

After install yo command tool, you also need to choose which project structure/template generator that you want to use.

  1. Open a web browser and goto search yeoman generators web site.
  2. Input keyword java in the search box, then it will list all related project structure/template generators in the page.
    search java project structure template generators for yoeman
  3. I choose jvm generator in this example, it can create java related project. The generator name is generator-jvm. You can click the link to goto it’s github website.
  4. Now run below command in terminal to install the generator-jvm java project generator.
    $ sudo npm install -g generator-jvm
  5. When above command complete, you can find generator-jvm has been installed in folder /usr/local/lib/node_modules/ also.

3. Create Java Project Structure Files.

Now both yoeman command line tool yo and the java project template generator has been installed successfully. It’s time to create java project starter structure files.

  1. Create a folder where your want the java project saved in.
  2. CD into above folder.
  3. Run below command to create the java project.
    $ yo jvm --name VSCJavaProect --type java
  4. After above command, folder VSCJavaProject has been created, there a a lot of java project related files in it.
    yoeman generated java project
  5. To create java spring boot project run below command.
    $ yo jvm --name VSCSpringBootProject --type java-spring-boot
  6. If you want to generate other java, scala or kotlin type project, you can run $ yo jvm command. It will first list all the project templates to let you choose, and then prompt you to input the project name after you select the template. Then it will create the project folder with the input name and save all the template files in it.
    192:VisualStudioCodeProject $ yo jvm
        |       |    ╭──────────────────────────╮
        |--(o)--|      Welcome to the terrific │
       `---------´     jvm generator v1.18.64  
        ( _´U`_ )    ╰──────────────────────────╯
        /___A___\   /
         |  ~  |     
     ´   `  |° ´ Y ` 
    ? What kind of project do you wanna build today, my friend? 
    ❯ java-ee
    (Move up and down to reveal more choices)
  7. Now you can use your favorite IDE to edit, build and run the project. We will tell you how to debug such a java project use visual studio code in next article.


  1. How To Install / Uninstall Node JS, NPM On Mac
  2. How To Install Node JS In Windows
  3. How To Use Node Package Manager
0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x