卡片式网站,体育类网站模板,茌平网页定制,天津住建网0. 背景1. 上传私有仓库2. 使用本地文件系统 0. 背景 对接一些第三方功能#xff0c;会拿到第三方的sdk#xff0c;也就是jar包#xff0c;如何导入呢 1. 上传私有仓库 最好的方式就是将第三方jar包#xff0c;上传到私有的仓库#xff0c;这样直接正常在pom引用即可如果只… 0. 背景1. 上传私有仓库2. 使用本地文件系统 0. 背景 对接一些第三方功能会拿到第三方的sdk也就是jar包如何导入呢 1. 上传私有仓库 最好的方式就是将第三方jar包上传到私有的仓库这样直接正常在pom引用即可如果只是本地开发可以将本地jar加载到本地mvn仓库执行如下命令 mvn install:install-file -Dfile./xxx-1.0.0.jar -DgroupIdcn.xxx.xxx -DartifactIdxxx -Dversion1.0.0 -Dpackagingjar即可引入对应groupId、artifactId、version的依赖如果要部署环境则不行但可以使用本地文件系统来处理 2. 使用本地文件系统 在pom的dependency中 使用scopesystem/scope 表示依赖来自本地文件系统而非 Maven 仓库 systemPath指定本地jar包路径建议放在项目中如systemPath${project.basedir}/lib/A.jar/systemPath dependencygroupIdcom.example/groupId !-- 自定义组ID --artifactIdA/artifactId !-- 自定义构件ID --version1.0.0/version !-- 自定义版本号 --scopesystem/scope !-- 指定作用域为 system --systemPath${project.basedir}/lib/A.jar/systemPath !-- 指定本地路径 --
/dependency!--指定使用maven打包--buildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactIdversion${springBoot.version}/versionconfigurationmainClasscom.example.MybatisExampleApplication/mainClass!--设置为true以便把本地的system的jar也包括进来--includeSystemScopetrue/includeSystemScope/configurationexecutionsexecutiongoalsgoalrepackage/goal/goals/execution/executions/plugin/buildgroupId、artifactId、version都是自定义的随便都行需要注意system作于的依赖作用域的依赖不会随项目打包可以通过mvn插件spring-boot-maven-plugin的includeSystemScopetrue/includeSystemScope配置解决