官术网_书友最值得收藏!

Introduction to Maven goals

Maven supports the concept of plugins, a plugin will be attached to a certain phase using a goal, and when that phase is executed the goal is run, if the goal fails the phase fails.

For example, in a Kotlin project a Kotlin plugin will set a goal named compile that is attached to the compile phase, so when we run the compile phase, it will compile the Kotlin source code.

We could run a goal from a plugin directly using the format mvn plugin:goal, for example in our application we could do the following:

mvnw kotlin:compile

This will compile our Kotlin code, however if other plugins have attached goals to the compile phase they will not run since we are not executing the phase, just a goal.

Spring Boot provides a plugin to run the application using Maven, which is under the spring-boot plugin and the goal name is run, so we could do the following:

mvnw spring-boot:run

After some seconds, our application will run and we should see this message, among others:

Tomcat started on port(s): 8080 (http)
Started Chapter2ApplicationKt in 1.999 seconds (JVM running for 6.747)

Currently, if we navigate to http://localhost:8080, we can see only an error page as we haven't added anything to our microservice yet. We can stop our application at any time by pressing Ctrl + C, but first, we need to understand further what pom.xml is.

主站蜘蛛池模板: 绥中县| 津市市| 玉田县| 中超| 苗栗市| 德州市| 玉龙| 台南市| 英吉沙县| 正镶白旗| 海晏县| 施秉县| 安康市| 鹰潭市| 布拖县| 安溪县| 榆林市| 顺昌县| 工布江达县| 濮阳县| 阿坝| 河北省| 贺兰县| 藁城市| 连平县| 郑州市| 阳江市| 万年县| 满城县| 英德市| 同江市| 乐业县| 中超| 临洮县| 政和县| 左权县| 邛崃市| 宾川县| 巴彦淖尔市| 甘肃省| 丰城市|