Table of Contents
Springboot spring-boot-maven-plugin import failed
spring-boot-maven-plugin plug-in function
You can specify in the POM whether Jar or War is generated
If you want to specify, you can use the following two methods:
Home Java javaTutorial How to solve Springboot's spring-boot-maven-plugin import failure

How to solve Springboot's spring-boot-maven-plugin import failure

May 12, 2023 pm 02:31 PM
maven springboot plugin

Springboot spring-boot-maven-plugin import failed

Because I changed the local warehouse before, it turned red when I opened the project again. The problem is that other dependencies have been imported, and only this guy is red. The glare.

Find the folder under the warehouse and delete the files inside (or delete the spring-boot-maven-plugin folder directly)

How to solve Springboots spring-boot-maven-plugin import failure

Refresh here, and then there is a long wait. If the network speed is not good, you can repeat this step again

How to solve Springboots spring-boot-maven-plugin import failure

spring-boot-maven-plugin plug-in function

The "org.springframework.boot:spring-boot-maven-plugin" plugin has been added to the POM file.

After adding this plug-in, when running "mvn package" for packaging, it will be packaged into a JAR file that can be run directly. Use the "Java -jar" command to run it directly.

This greatly simplifies the deployment of applications. You only need to install JRE to run.

You can specify in the POM whether Jar or War is generated

<project xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- ... -->
<packaging>jar</packaging>
<!-- ... -->
</project>
Copy after login

You can also specify the class to be executed. If not specified, Spring will find this [public static void main( String[] args)] method class, treated as an executable class.

If you want to specify, you can use the following two methods:

1. If your POM inherits spring-boot-starter-parent, you only need to specify the following.

<properties>
    <!-- The main class to start by executing java -jar -->
    <start-class>com.mycorp.starter.HelloWorldApplication</start-class>
</properties>
Copy after login

2. If your POM does not inherit spring-boot-starter-parent, you need to specify the following.

<plugin>
      <groupid>org.springframework.boot</groupid>
      <artifactid>spring-boot-maven-plugin</artifactid>
      <version>1.3.5.RELEASE</version>
      <configuration>
        <mainclass>${start-class}</mainclass>
        <layout>ZIP</layout>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>repackage</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
Copy after login

The above is the detailed content of How to solve Springboot's spring-boot-maven-plugin import failure. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Java Maven build tool advancement: optimizing compilation speed and dependency management Java Maven build tool advancement: optimizing compilation speed and dependency management Apr 17, 2024 pm 06:42 PM

Optimize Maven build tools: Optimize compilation speed: Take advantage of parallel compilation and incremental compilation. Optimize dependencies: Analyze dependency trees and use BOM (bill of materials) to manage transitive dependencies. Practical case: illustrate optimizing compilation speed and dependency management through examples.

Avoid common mistakes in Maven environment configuration: Solve configuration problems Avoid common mistakes in Maven environment configuration: Solve configuration problems Feb 19, 2024 pm 04:56 PM

Maven is a Java project management and build tool that is widely used in the development of Java projects. In the process of using Maven to build projects, you often encounter some common environment configuration problems. This article will answer these common questions and provide specific code examples to help readers avoid common configuration errors. 1. Maven environment variables are incorrectly configured. Problem description: When using Maven, if the environment variables are incorrectly configured, Maven may not work properly. Solution: Make sure

A complete guide to installing and configuring Maven on Mac systems A complete guide to installing and configuring Maven on Mac systems Jan 28, 2024 am 09:42 AM

Detailed explanation of the methods and techniques of installing Maven on Mac system. As a developer, installing Maven on Mac system is a very common requirement, because Maven is a very popular build tool for managing the dependencies and build process of Java projects. This article will introduce in detail the methods and techniques of installing Maven on Mac system, and provide specific code examples. 1. Download Maven first, you need to download it from the official website (https://maven.apache.org/down

Guide to setting up Maven local libraries: efficiently manage project dependencies Guide to setting up Maven local libraries: efficiently manage project dependencies Feb 19, 2024 am 11:47 AM

Maven local warehouse configuration guide: Easily manage project dependencies. With the development of software development, project dependency package management has become more and more important. As an excellent build tool and dependency management tool, Maven plays a vital role in the project development process. Maven will download project dependencies from the central warehouse by default, but sometimes we need to save some specific dependency packages to the local warehouse for offline use or to avoid network instability. This article will introduce how to configure Maven local warehouse for easy management

Basic tutorial: Create a Maven project using IDEA Basic tutorial: Create a Maven project using IDEA Feb 19, 2024 pm 04:43 PM

IDEA (IntelliJIDEA) is a powerful integrated development environment that can help developers develop various Java applications quickly and efficiently. In Java project development, using Maven as a project management tool can help us better manage dependent libraries, build projects, etc. This article will detail the basic steps on how to create a Maven project in IDEA, while providing specific code examples. Step 1: Open IDEA and create a new project Open IntelliJIDEA

Best practices and recommended methods for setting Java versions in Maven Best practices and recommended methods for setting Java versions in Maven Feb 22, 2024 pm 03:18 PM

When using Maven to build a Java project, you often encounter situations where you need to set the Java version. Correctly setting the Java version can not only ensure that the project runs normally in different environments, but also avoid some compatibility issues and improve the stability and maintainability of the project. This article will introduce the best practices and recommended methods for setting Java versions in Maven, and provide specific code examples for reference. 1. Set the Java version in the pom.xml file. In the pom.xml file of the Maven project, you can

How to disable test cases in Maven? How to disable test cases in Maven? Feb 26, 2024 am 09:57 AM

Maven is an open source project management tool that is commonly used for tasks such as construction, dependency management, and document release of Java projects. When using Maven for project build, sometimes we want to ignore the testing phase when executing commands such as mvnpackage, which will improve the build speed in some cases, especially when a prototype or test environment needs to be built quickly. This article will detail how to ignore the testing phase in Maven, with specific code examples. Why you should ignore testing During project development, it is often

Complete guide to install Maven on CentOS7 Complete guide to install Maven on CentOS7 Feb 20, 2024 am 10:57 AM

Detailed tutorial on how to install Maven under CentOS7 Maven is a popular project management tool developed by the Apache Software Foundation. It is mainly used to manage the construction, dependency management and project information management of Java projects. This article will detail the steps on how to install Maven in CentOS7 system, as well as specific code examples. Step 1: Update the system Before installing Maven, you first need to ensure that the system is up to date. Open a terminal and run the following command to update the system: sudoy

See all articles