自己写jar包maven导入使用步骤

1.把自己写的达成jar包,配个下载的插件,

<plugin>
      <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-compiler-plugin</artifactId>
       <version>3.3</version>
       <configuration>
           <source>1.8</source>
           <target>1.8</target>
           <encoding>UTF-8</encoding>
           <compilerArguments>
               <extdirs>${project.basedir}/src/main/resources/lib</extdirs>
           </compilerArguments>
	</configuration>
</plugin>

${project.basedir}/src/main/resources/lib
${project.basedir}这是你项目的名字,版本号啥的,后面是下载路径,假如你点的maven插件的packge,那就只会在你的target目录有着jar包,install会给你在maven仓库下载下来,路径就是你的maven本地仓库路径/你的项目组(比如com.meng)/你的项目名,里面会有版本号啥的。
例如:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.mbyte</groupId>
    <artifactId>easy</artifactId>
    <version>0.0.2-SNAPSHOT</version>
    <name>easy</name>
    <description>easy-byte</description>

拿到这几行方便使用jar包的调用

    <groupId>com.mbyte</groupId>
    <artifactId>easy</artifactId>
    <version>0.0.2-SNAPSHOT</version>

2.把你生成的jar包粘贴到maven本地仓库

在这里插入图片描述

3.然后就是使用了

你那个jar最好是springboot的maven插件给你生成的,规范
加入依赖,里面就是jar保那保存的

<dependency>
           <groupId>com.mbyte</groupId>
    <artifactId>easy</artifactId>
    <version>0.0.2-SNAPSHOT</version>
</dependency>

然后就可以使用了

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值