zoukankan      html  css  js  c++  java
  • maven排除依赖和添加本地依赖

    1.在需要引用依赖包的包配置下添加exclusions标签,在里面添加一个排除依赖项,

    如下图所示:

    <!--web 模块-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>2.0.8.RELEASE</version>
                <exclusions>
                    <!--排除tomcat依赖-->
                    <exclusion>
                        <artifactId>spring-boot-starter-tomcat</artifactId>
                        <groupId>org.springframework.boot</groupId>
                    </exclusion>
                    <!--排除log4j-2.x依赖-->
                    <exclusion>
                        <artifactId>log4j-to-slf4j</artifactId>
                        <groupId>org.apache.logging.log4j</groupId>
                    </exclusion>
                </exclusions>
            </dependency>

    2.在dependencies标签里添加一个dependency标签,引入一个本地的jar包,

    ${pom.basedir}有时可以用${project.basedir}代替,有时会报错,视具体情况而定。

    如下图所示:

    <!-- log4j-2.x解决安全漏洞 -->
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-to-slf4j</artifactId>
                <version>2.15.0-rc2</version>
                <scope>system</scope>
                <systemPath>${pom.basedir}/src/main/webapp/log4j-to-slf4j-2.15.0-rc2.jar</systemPath>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>2.15.0-rc2</version>
                <scope>system</scope>
                <systemPath>${pom.basedir}/src/main/webapp/log4j-api-2.15.0-rc2.jar</systemPath>
            </dependency>

     3.本地引入的jar包在打包时并不会自动打到jar包里,需要手动设置,设置如下:

    <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <includeSystemScope>true</includeSystemScope>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.mybatis.generator</groupId>
                    <artifactId>mybatis-generator-maven-plugin</artifactId>
                    <version>1.3.7</version>
                    <configuration>
                        <verbose>true</verbose>
                        <overwrite>true</overwrite>
                    </configuration>
                </plugin>
            </plugins>
        </build>
  • 相关阅读:
    GDC2017:Framegraph-extensible-rendering-architecture-in-frostbite
    17072802(UE4的批量Import)
    16011301(统计指令数影响耗时)
    16080401(面向摄像机的Instance模型)
    UE4编译_201701
    17020701(AnimDynamic继续)
    Python过滤utf8mb4无效字符
    Windows下安装MySQL-python
    使用Pycharm更新Github项目(到源项目)
    python异常:error: command 'gcc' failed: No such file or directory
  • 原文地址:https://www.cnblogs.com/zhncnblogs/p/15688360.html
Copyright © 2011-2022 走看看