Springboot project packaging and packaging encountered various problems

 PS: The above information comes from the Internet

1. IDEA packages the springboot project

How does IDEA package springboot into a jar package, and run, stop, restart, and what to do if local dependencies cannot be packaged?

2.[WARNING] Error injecting: org.springframework.boot.maven.RepackageMojo

1. Annotate the local Ali image 

2. The version number of the springboot maven packaged plug-in must be the same as the version of the springboot project

            <plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>${spring-boot.version}</version> // springboot项目版本号相同
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中 -->
						</goals>
					</execution>
				</executions>
			</plugin>

If the project has spring-boot-starter-parent dependencies, then the problem does not exist, but our project has its own private parent, and the spring-boot-maven-plugin version constraint is not added to the pom, so the project does not specify the version. The latest version in the image configured by setting will be pulled down (just at this time, when Ali releases a latest image with a special class, a TypeNotPresentException will be reported).


3.XXX--1.0-SNAPSHOT.jar has no main manifest property

Your pom.xml needs such a plugin.

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>${spring-boot.version}</version>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中 -->
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

4.java.io.FileNotFoundException: .\xxx\xxx.txt (The system cannot find the specified path.)

Anyway, the springboot project is packaged and designed, where the io flow is, "absolute paths are the best to use."

About a novice in IntelliJ IDEA that is easy to be pitted - java.io.FileNotFoundException: jdbc.properties (The system cannot find the specified file.)_maybein's Blog - CSDN Blog

Guess you like

Origin blog.csdn.net/Qhx20040819/article/details/132181676