自动从远程仓库下载依赖

提示

可直接从gitee中拉取项目,进入gitee仓库地址在新窗口打开
gitee地址:https://gitee.com/march-x/keepReport.git

1、配置远程仓库

快照版本的远程仓库后续发布

1.1 pom.xml 配置

  • 作用范围:项目配置文件,仅影响当前项目

  • 在项目的 pom.xml 中配置指定的远程仓库地址

配置教程:点击进入教程在新窗口打开

<repository>
    <id>keep-report-releases</id>
    <url>https://maven.tt-u.cn/maven/repository</url>
</repository>

1.2 settings.xml 配置

  • 作用范围:全局配置文件,影响所有使用该配置的Maven项目

  • maven安装目录下 conf\settings.xml 全局配置文件

教程:点击进入教程在新窗口打开

<repository>
    <id>keep-report-releases</id>
    <url>https://maven.tt-u.cn/maven/repository</url>
</repository>

Maven 依赖配置

  1. 打开您的 Maven 项目,并找到项目根目录下的 pom.xml 文件。

  2. pom.xml 文件的 <dependencies> 标签内,添加以下依赖配置:

<!-- 1.0.6为版本号,如果文档未及时更新请自行更换 -->

<dependency>
    <groupId>com.march.report</groupId>
    <artifactId>keep-report-spring-boot-starter</artifactId>
    <version>1.0.6</version>
</dependency>

完整的 pom.xml 示例

<?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 https://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.5.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.demo</groupId>
    <artifactId>reportDemo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>reportDemo</name>
    <description>reportDemo</description>
    <properties>
        <java.version>8</java.version>
    </properties>

    <!-- 远程仓库配置 -->
    <repositories>
        <repository>
            <id>keep-report-releases-test</id>
            <url>https://maven.tt-u.cn/maven/repository</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

        <!-- 依赖包引入 -->
        <dependency>
            <groupId>com.march.report</groupId>
            <artifactId>keep-report-spring-boot-starter</artifactId>
            <version>1.0.6</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

引入 keep-report-spring-boot-starter 的依赖完成后看下一步

点击查看下一步