maven怎么引入自定义(本地第三方)jar图文教程

    xiaoxiao2021-03-25  97

    maven自jar引入本地   eclipse/maven使用教程系列

    1 首先找到你的maven的配置文件{你maven的路径}\conf\settings.xml,然后打开settings.xml,并修改你存放本地jar路径。如我想把我自己的jar放到C:\Users\user\.m2\localRepository。

    2 假如你自定义的jar包是123456.jar,你想在你项目的pom.xml中这样引入你的jar包

    [html] view plain copy print ? <dependency>                <groupId>123456</groupId>                <artifactId>123456</artifactId>                <version>1.0</version>    </dependency>    <dependency> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </dependency> 3 在你的文件夹下建立如下文件夹

    在C:\Users\user\.m2\localRepository\  创建123456文件夹 ---->再创建123456文件夹----->再创建1.0文件夹

    最后把123456.jar放到1.0文件夹下

    转载请标明链接:http://blog.csdn.net/wabiaozia?viewmode=contents

    如下图所示

    4 把123456.jar改为123456-1.0.jar,并创建文件123456-1.0.pom

    然后在123456-1.0.pom中写如下内容

    [html] view plain copy print ? <project>     <modelVersion>1.0.0</modelVersion>     <groupId>123456</groupId>     <artifactId>123456</artifactId>     <version>1.0</version>   </project>    <project> <modelVersion>1.0.0</modelVersion> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </project> 5 在你的项目的pom.xml依赖中引入就行了

    [html] view plain copy print ? <dependency>                <groupId>123456</groupId>                <artifactId>123456</artifactId>                <version>1.0</version>    </dependency>   <dependency> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </dependency> 6 如果你的pom.xml报错

    然后勾选 force update of snapshots/releases 选项即可。

    7 关于groupId,artifactId怎么写再举一例

    jar包的位置

    pom.xml中引入

    [html] view plain copy print ? <dependency>            <groupId>com.taibao</groupId>            <artifactId>Butils</artifactId>            <version>1.0</version>  </dependency>   <dependency> <groupId>com.taibao</groupId> <artifactId>Butils</artifactId> <version>1.0</version> </dependency>

    我博客所有文章链接:http://blog.csdn.net/wabiaozia?viewmode=contents

    
    转载请注明原文地址: https://ju.6miu.com/read-20937.html

    最新回复(0)