java - 解包依赖项需要很长时间
问题描述
嗨,我有一个带有模块的 Maven,在 intellij 中使用全新安装构建该模块时,完成构建需要很长时间。这是我的 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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.blah.cdo.hook</groupId>
<artifactId>committerIdentityHook</artifactId>
<version>0.11-SNAPSHOT</version>
<organization>
<name>CTO - blah</name>
<url>http://www.blah.com/</url>
</organization>
<name>blah test Hook-5.16.3</name>
<description>Verify commit author’s email address against HR Feed. Functional accounts adhere to this format:
FID@blah.blah.com
</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-api</artifactId>
<version>${bitbucket.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-spi</artifactId>
<version>${bitbucket.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>apache-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>12.1.0.2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>1.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<classifier>runtime</classifier>
<scope>test</scope>
<version>0.8.0</version>
</dependency>
<dependency>
<groupId>com.blah.cto.bbengarch</groupId>
<artifactId>AppEncryptDecrypt</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>bitbucket-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<products>
<product>
<id>bitbucket</id>
<instanceId>bitbucket</instanceId>
<version>${bitbucket.version}</version>
<dataVersion>${bitbucket.data.version}</dataVersion>
</product>
</products>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>1.2.6</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destfile>${project.build.directory}/jacoco/jacoco.exec</jacoco-agent.destfile>
<testEnvironment>true</testEnvironment>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<executions>
<execution>
<id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>default-restore-instrumented-classes</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/jacoco/jacoco.exec</dataFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<bitbucket.version>5.16.2</bitbucket.version>
<bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
<amps.version>6.2.0</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<java.version>1.8</java.version>
</properties>
<scm>
<connection>https://bitbucketdc-cluster04.blah.net/scm/bbengarch/committervalidator-hook.git</connection>
<developerConnection>
scm:git:https://bitbucketdc-cluster04.blah.net/scm/bbengarch/committervalidator-hook.git
</developerConnection>
<url>https://bitbucketdc-cluster04.blah.net/scm/bbengarch/committervalidator-hook.git</url>
<tag>HEAD</tag>
</scm>
<distributionManagement>
<snapshotRepository>
<id>JULES</id>
<url>https://repo.blah.net/maven/content/repositories/BBENGARCH-SNAPSHOT/</url>
</snapshotRepository>
<repository>
<id>JULES</id>
<url>https://repo.blah.net/maven/content/repositories/BBENGARCH/</url>
</repository>
</distributionManagement>
</project>
在构建 jar 时 --- bitbucket-maven-plugin:6.2.0:copy-bundled-dependencies (default-copy-bundled-dependencies) @ committerIdentityHook --- phase 它需要很长时间,比如 1hr -2hrs。每次我改变一些东西,如果想用新的改变重建罐子,这对我来说变得非常困难。以下是需要很长时间的解包依赖项。还有一些其他的,但我观察到这需要很长时间。解压 c:\FAST\maven_repo\v360\oracle\jdbc\ojdbc6\12.1.0.2.0\ojdbc6-12.1.0.2.0.jar 到 H:\Susmitha\Projects\commhookcode-nov7\committervalidator-hook\commiterValidator-5.16 .3\target\classes 包含“”并排除“atlassian-plugin.xml,META-INF/MANIFEST.MF,META-INF/ .DSA,META-INF/ .SF”
请让我知道为什么需要很长时间以及如何以简单的方式构建我的 jar。
谢谢你。
解决方案
我认为你的问题的根源是你的H:
文件系统的性能。根据驱动器名称,我猜测它实际上是一个 Windows 网络共享;即当您访问H:
您的系统时,您正在使用 SMB 与单独文件服务器上的文件系统通信,
问题是 SMB 不是一个快速的协议,特别是当您创建大量文件时。当您将 JAR 文件解压缩到网络共享中时,您将创建许多相对较小的文件。
我的建议:
更改构建设置,使构建目录位于本地驱动器上。
如果构建仍然不够快,请考虑将构建平台更改为 Linux 机器……因为 Linux 通常具有比 Windows 更好的文件系统性能。
推荐阅读
- angular - Angular 6 材质输入动态占位符是否可行?
- javascript - 在 Django 模板中使用来自服务器的图像
- apache-kafka-streams - 为什么启用了 suppress() 时 Kafka Stream 应用程序会崩溃?
- javascript - 如何正确地向 TypeScript 添加带参数的回调类型?
- sql - 对条件使用不存在
- android - 如何使用 Retrofit 将图像文件从 Android 上传到 ASP.NET(Web Services-ASMX) 上传文件夹
- assembly - 如何修复“在当前 PC 0x0 未找到源代码行。打开程序存储器视图以查看指令代码反汇编。' 在 MplabX 中
- javascript - 调用 USB 设备麦克风时 Web USB API 无法正常工作
- c# - Azure 移动 EasyTables 连接字符串
- c# - 使用 IAuthorizationFilter 和 Windows 身份验证进行简单检查