我正在匯入一個由某人開發的專案。
但是,當我匯入專案時,我在 pom.xml 中不斷收到此錯誤:
org.apache.maven.plugins:maven-shade-plugin:pom:3.2.4在之前的嘗試中未能從https://repo.maven.apache.org/maven2傳輸。此故障已快取在本地存盤庫中,并且直到中央的更新間隔已過或強制更新時才重新嘗試解決。原始錯誤:無法傳輸工件 org.apache.maven.plugin...
我該如何解決這個問題?
這是專案的 pom.xml
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eLoki2</groupId>
<artifactId>eLoki2</artifactId>
<version>0.6.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>net.sourceforge.argparse4j</groupId>
<artifactId>argparse4j</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.36.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.1</version>
</dependency>
<dependency>
<groupId>com.github.joonasvali.naturalmouse</groupId>
<artifactId>naturalmouse</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>
<build>
<finalName>eLoki2</finalName>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- fix for Selenium 4 https://github.com/SeleniumHQ/selenium/issues/10132#issuecomment-1035028801 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>core.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<jar>${project.build.directory}/${project.artifactId}.jar</jar>
<outfile>${project.build.directory}/eLoki2.exe</outfile>
<downloadUrl>http://java.com/download</downloadUrl>
<classPath>
<mainClass>core.Main</mainClass>
<preCp>anything</preCp>
</classPath>
<jre>
<minVersion>1.8.0</minVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<copyright>2021 Chonglun Chen</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>1.0.0.0</txtProductVersion>
<productName>${project.name}</productName>
<companyName>York University</companyName>
<internalName>eLoki2</internalName>
<originalFilename>eLoki2.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
我嘗試了智能匯入,手動匯入并不斷收到相同的錯誤。
uj5u.com熱心網友回復:
您使用的版本不是最新版本(3.4.1),并且<configuration>標簽應該在<executions>標簽之外。
在此處查看有關如何配置maven-shade-plugin的官方檔案: https ://maven.apache.org/plugins/maven-shade-plugin/usage.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/524003.html
標籤:爪哇行家pom.xml
