Open maven package and import local jar package

In maven development, under normal circumstances, you need to download the jar package from the maven warehouse, you only need to configure it in the pom.xml file, but in some cases, the maven warehouse is not managed by itself, and does not contain the jar package that needs to be used. , then you need to introduce the jar package yourself in the project. The steps are as follows:
1. Create a new folder in the root directory;
2. Make an absolute reference to the project file in the pom file;

an example is as follows:
For example, if you need to introduce struts unit test related packages into the project, you can configure the following in maven:

<!-- Unit testing only -->
		<dependency>
		    <groupId>cn.mamp</groupId>
		    <artifactId>jsp-api</artifactId>
		    <version>2.0</version>
		    <type>jar</type>
		    <scope>system</scope>
		    <systemPath>${basedir}/junitlib/jsp-api-2.0.jar</systemPath>
		</dependency>
		<dependency>
		    <groupId>cn.mamp</groupId>
		    <artifactId>spring-test</artifactId>
		    <version>3.0.5</version>
		    <type>jar</type>
		    <scope>system</scope>
		    <systemPath>${basedir}/junitlib/spring-test-3.0.5.RELEASE.jar</systemPath>
		</dependency>
		<dependency>
		    <groupId>cn.mamp</groupId>
		    <artifactId>struts2-junit</artifactId>
		    <version>2.3.32</version>
		    <type>jar</type>
		    <scope>system</scope>
		    <systemPath>${basedir}/junitlib/struts2-junit-plugin-2.3.32.jar</systemPath>
		</dependency>
		<!-- Unit testing only -->


Maven built-in variable description:
  • ${basedir} project root directory
  • ${project.build.directory} build directory, default is target
  • ${project.build.outputDirectory} build process output directory, default is target/classes
  • ${project.build.finalName} Artifact name, default is ${project.artifactId}-${project.version}
  • ${project.packaging} packaging type, the default is jar
  • ${project.xxx} The content of any node of the current pom file

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326042852&siteId=291194637