• maven使用本地jar并打包


    1.maven使用本地jar

    在当前的工程创建一个lib文件夹,然后把jar文件扔进去。
    修改pom.xml

            <dependency>
                <groupId>unidbg-api</groupId>
                <artifactId>unidbg-api</artifactId>
                <version>0.9</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/lib/unidbg-api-0.9.0-SNAPSHOT.jar</systemPath>
            </dependency>
    

    解释

    scope:代码加载本地的
    systemPath是找本工程下面的lib文件夹下的对应jar文件
    

    这两个必须写的,否则会加载远程仓库的jar包切记。

    2.打包的时候如果含有本地的jar依赖会无法直接打入

    此时使用

                        <includeSystemScope>true</includeSystemScope>
    
    

    完整的pom文件如下

    <?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.4.0</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.spider</groupId>
        <artifactId>unidbg-server</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>unidbg-server</name>
        <description>r Spring Boot</description>
    
        <properties>
            <java.version>1.8</java.version>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</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-web</artifactId>
                <version>RELEASE</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>5.2.10.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>net.java.dev.jna</groupId>
                <artifactId>jna</artifactId>
                <version>4.1.0</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>2.4</version>
            </dependency>
            <dependency>
                <groupId>com.github.zhkl0228</groupId>
                <artifactId>keystone</artifactId>
                <version>0.9.2</version>
            </dependency>
            <dependency>
                <groupId>com.github.zhkl0228</groupId>
                <artifactId>capstone</artifactId>
                <version>3.0.8</version>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.6</version>
            </dependency>
            <dependency>
                <groupId>com.github.zhkl0228</groupId>
                <artifactId>unicorn</artifactId>
                <version>1.0.9</version>
            </dependency>
            <dependency>
                <groupId>unidbg</groupId>
                <artifactId>unidbg</artifactId>
                <version>0.9</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/lib/unidbgok.jar</systemPath>
            </dependency>
            <dependency>
                <groupId>unidbg-api</groupId>
                <artifactId>unidbg-api</artifactId>
                <version>0.9</version>
                <scope>system</scope>
                <systemPath>${project.basedir}/lib/unidbg-api-0.9.0-SNAPSHOT.jar</systemPath>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <skipTests>true</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.0.1.RELEASE</version>
                    <configuration>
                        <fork>true</fork>
                        <mainClass>com.crack.DouyinSign</mainClass>
                        <includeSystemScope>true</includeSystemScope>
                        <!--                    <finalName>unidbg0.9</finalName>-->
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
    
            </plugins>
    
        </build>
    
    
    </project>
    
    
  • 相关阅读:
    排序算法---堆排序

    排序算法---希尔排序
    简单排序算法
    Jave 垃圾回收查看工具--jstat
    Linux 查看进程IO状态
    vittualenv 和mkvirtualenv
    服务器被当作了肉机去挖矿的解决办法
    pycharm的函数注释 和 父子组件传递
    git初始化操作
  • 原文地址:https://www.cnblogs.com/c-x-a/p/14004926.html
Copyright © 2020-2023  润新知