Spring Boot, parsing the pom.xml
Spring Boot can be easy to start up:options
Diving right in letting Spring Boot introductions be covered in another blog....One way is to navigate to: https://start.spring.io and find a page like the below:
Just select the options then click Generate (not shown). This will download a zip file which can then be imported easily into your IDE. I use STS eclipse, after import, the result was:
Because I selected Maven, there is a pom.xml file which is instructive. It includes the necessary dependencies. I could have specified them on the web page, but I usually just paste them in.
Below is the pom.xml file contents from the demo:
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<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>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Note that it includes the Spring Boot version as well as the Java version.
This method is common and preferred by many, but from within STS, we can also just use File>New> New Spring Starter project as below:
Note that we have the same options as the online version.
Thus, a general overview of Spring Boot starters.
Subjects for further explanation would be Maven and pom.xml details, Maven versus Gradle, and the WAR packaging option.
~~~
Comments
Post a Comment