Maven packaging and deployment will not depend on the methods included in the generated project jar.

Use provided

<dependency>
			<groupId>commons-jdk</groupId>
			<artifactId>commons-jdk</artifactId>
			<version>1.8</version>
			<scope>provided</scope>
		</dependency>  

In a Maven project, scope is one of the elements that specifies the visibility and lifecycle scope of dependencies. In the pom.xml you provided, <scope>provided</scope>it says that the dependency will be visible during compilation and testing phases, but will not be included in the generated project at runtime.

Specifically, when you use <scope>provided</scope>Maven, Maven will ensure that the dependency is available for compiling and testing the code, but will not be included in the generated project when the project is packaged. At this point, you need to ensure that the dependency is available in the runtime environment, such as provided by the container or deployment environment.

In the example you provided, commons-codecthe dependency's scope is set to provided, which means it will be used for compilation of development and test code, but will not be included in the final generated project.

Guess you like

Origin blog.csdn.net/weixin_48616345/article/details/133030334