Episode 3, Build and run with maven

Episode 3, Build and run with maven

Season 4, Spring time

We are going to run the app to make sure everything works. For this we’ll use maven first:

  1. Open the maven panel (on the to the right).
  2. You’ll see the name of your project.
  3. Now we’ll use maven to build.
  4. Navigate to Lifecycle and double-click on package.
  5. The Run panel will open at the bottom of the IDE and will show you the logs from this action.
  6. It’ll take a while till the action will finish, in the end you’ll see a message saying BUILD SUCCESS
  7. In the maven panel navigate to Plugins / spring-boot and double click on spring-boot:run
  8. This will open the Run panel, and you’ll see lots of logs, and in 2-15 seconds your app will start, depending on the machine you use.

What if build fails ?

  1. Your build might fail because of missing or failing dependency related to jsonway / jsonpath
  2. Open pom.xml file
  3. Find this block
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
    </exclusions>
</dependency>
  1. Add this extra exclusion
<exclusion>
    <groupId>com.jayway.jsonpath</groupId>
    <artifactId>json-path</artifactId>
</exclusion>
  1. So that the complete block looks like this
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
        <exclusion>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
        </exclusion>
    </exclusions>
</dependency>
  1. Rebuild the project with the package step described above.