连续复制
一键复制
一键打包

mvn 引用本地jar

1、安装到本地仓库

mvn install:install-file -Dfile=/Users/yinluobing/Documents/spider-flow/spider-flow-selenium/target/spider-flow-selenium-0.5.0.jar -DgroupId=org.spiderflow -DartifactId=spider-flow-selenium -Dversion=0.5.0 -Dpackaging=jar

2、引用

    <dependency>
      <groupId>org.spiderflow</groupId>
      <artifactId>spider-flow-selenium</artifactId>
      <version>0.5.0</version>
    </dependency>

依赖分析

mvn dependency:analyze

解压jar

jar -xvf xxx.jar

java 项目只打包本项目

pom.xml

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.spiderflow</groupId>
    <artifactId>spider-flow</artifactId>
    <version>0.5.0</version>
  </parent>
  <artifactId>spider-flow-web</artifactId>
  <name>spider-flow-web</name>
  <url>https://gitee.com/ssssssss-team/spider-flow/tree/master/spider-flow-web</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <scope>runtime</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.spiderflow</groupId>
      <artifactId>spider-flow-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.spiderflow</groupId>
      <artifactId>spider-flow-selenium</artifactId>
      <version>0.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.spiderflow</groupId>
      <artifactId>spider-flow-proxypool</artifactId>
      <version>0.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.spiderflow</groupId>
      <artifactId>spider-flow-redis</artifactId>
      <version>0.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.spiderflow</groupId>
      <artifactId>spider-flow-ocr</artifactId>
      <version>0.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.spiderflow</groupId>
      <artifactId>spider-flow-mailbox</artifactId>
      <version>0.5.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <finalName>spider-flow</finalName>
          <!-- 指定该jar包启动时的主类[建议] -->
          <mainClass>org.spiderflow.SpiderApplication</mainClass>
          <layout>ZIP</layout>
          <includes>
            <!-- 排除第三方依赖jar(只保留本项目的jar) -->
            <include>
              <groupId>${project.groupId}</groupId>
              <artifactId>${project.artifactId}</artifactId>
            </include>
          </includes>
        </configuration>
      </plugin>
      <!-- 把项目依赖的第三方包打包在target/lib下 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/lib</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <resources>

      <!-- 排除resources下的配置文件 -->
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>static/**</exclude>
          <exclude>templates/**</exclude>
          <exclude>*.yml</exclude>
          <exclude>*.properties</exclude>
          <exclude>*.xml</exclude>
          <exclude>*.txt</exclude>
          <exclude>*.json</exclude>
          <exclude>codetemplate/**</exclude>
          <exclude>lib/**</exclude>
        </excludes>
        <targetPath>BOOT-INF/classes/</targetPath>
      </resource>

      <!-- 打包lib下的jar包 -->
      <resource>
        <directory>lib</directory>
        <targetPath>BOOT-INF/lib/</targetPath>
        <includes>
          <include>**/*.jar</include>
        </includes>
      </resource>
    </resources>
    <finalName>spider-flow</finalName>
  </build>
</project>