Sargon1 Sargon1 - 10 days ago 5
Java Question

Eclipse doesn't see Maven dependency

I'm trying to change a Maven dependency from the current one to another. This other dependency offers almost entirely, save for a few changes, the same functionality as the current one, because the current one is a fork of the older version of the another. To do this, I have:


  1. Changed all references to the old dependency in the pom to the new dependency

  2. Deleted and re-imported the project in Eclipse

  3. Ran
    maven clean install



However, I'm still encountering the same problems as at the beginning:


  1. Eclipse doesn't see any classes of the dependency. It doesn't even offer to import them.

  2. Upon trying
    mvn clean package
    on the project, Maven fails the build with the following error message:

    [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]



I have checked the pom for typos and the version for correctness, so those shouldn't be a problem. I'm suspecting that this has to do with the dependencies/dependency management/jitpack and how they work. I never really touched them; everything in there is either copied over from the starting code that I had for the project or a result of my subsequent wiggling with Maven, in which I'm almost complete beginner. I took a look at this question and tried the solutions there, but none of them work in my case.

How do I make Maven see the dependency and its transitive dependencies again, and compile the project correctly?

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>


EDIT: The dependency in question on GitHub

EDIT 2: I changed the pom as follows and I have apparently appeased the spirits of Maven into building the project again. Eclipse let me import all the stuff that it couldn't see before. Explanation of this sudden change of mind would still be a valuable conclusion to his question, however.

<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>

Answer

The dependency should be :

<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>

you add an extra k to tordova