我正在尝试将Maven依赖项从当前更改为另一个。除了一些更改之外,这个其他依赖项几乎完全提供与当前依赖项相同的功能,因为当前的依赖项是另一个版本的旧版本的分支。要做到这一点,我有:
maven clean install
然而,我仍然遇到与开始时相同的问题:
在项目上尝试mvn clean package
时,Maven使用以下错误消息使构建失败:
[ERROR] Failed to execute goal on project eet-demo-maven: Could not resolve dependencies for project cz.tomasdvorak:eet-demo-maven:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.github.todvorak:eet-client:jar:1.3.2: Failed to read artifact descriptor for com.github.todvorak:eet-client:jar:1.3.2: Could not transfer artifact com.github.todvorak:eet-client:pom:1.3.2 from/to jitpack.io (https://jitpack.io): Not authorized , ReasonPhrase:Repo not found or no access token provided. -> [Help 1]
我已经检查过ppos的错别字和版本的正确性,所以那些应该不是问题。我怀疑这与依赖关系/依赖关系管理/ jitpack以及它们如何工作有关。我从来没有碰过他们;那里的所有内容都要么是从我为项目开始的代码中复制出来的,要么是我随后与Maven摆弄的结果,其中我几乎完全是初学者。我看了一下this问题,并在那里尝试了解决方案,但在我的案例中没有一个可以解决。
如何让Maven再次看到依赖项及其传递依赖项,并正确编译项目?
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<dontWrapJar>true</dontWrapJar>
<headerType>console</headerType>
<jar>eet-demo-maven-1.0-SNAPSHOT.jar</jar>
<outfile>target\EETSender.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>true</stayAlive>
<restartOnCrash>true</restartOnCrash>
<manifest></manifest>
<icon></icon>
<singleInstance>
<mutexName>EETMutex</mutexName>
<windowTitle></windowTitle>
</singleInstance>
<classpath>
<mainClass>cz.tomasdvorak.eetdemo.Main</mainClass>
</classpath>
<jre>
<path></path>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<minVersion>1.6.0_1</minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
</jre>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>cz.tomasdvorak.eetdemo.Main</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
<groupId>cz.tomasdvorak</groupId>
<artifactId>eet-demo-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.todvorak</groupId>
<artifactId>eet-client</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.todvorak</groupId>
<artifactId>eet-client</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
编辑:The dependency in question on GitHub
编辑2:我改变了如下的pom,我显然已经将Maven的精神安抚到了再次建造项目中。 Eclipse让我导入之前看不到的所有东西。然而,对这种突然改变的解释仍然是他的问题的一个有价值的结论。
<project>
.
.
.
<dependencies>
<dependency>
<groupId>com.github.todvora</groupId>
<artifactId>eet-client</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
<!--
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.todvorak</groupId>
<artifactId>eet-client</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</dependencyManagement>
-->
</project>
答案 0 :(得分:2)
依赖应该是:
<dependencies>
<dependency>
<groupId>com.github.todvora</groupId>
<artifactId>eet-client</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.todvora</groupId>
<artifactId>eet-client</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</dependencyManagement>
你向tordova添加额外的k