3

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>
Community
  • 1
  • 1
Sargon1
  • 854
  • 5
  • 17
  • 48
  • 1
    Seems like a dependency cannot be downloaded. Maybe because of rights or maybe it isn't deployed yet. Can you manually download the dependency `com.github.todvorak:eet-client:jar:1.3.2` ? – Jeroen van Dijk-Jun Nov 15 '16 at 09:26
  • It would seem so. I don§t know what exactly you mean by that, but you can get it through the "Clone or download" button on GitHub and it is under the JitPack button. – Sargon1 Nov 15 '16 at 09:36
  • Then it probably is deployed, try to download the file manually using your maven settings etc. See http://stackoverflow.com/questions/1895492/how-can-i-download-a-specific-maven-artifact-in-one-command-line on how to call it. If it's downloaded, then the problem is somewhere else, but I kind of doubt that... – Jeroen van Dijk-Jun Nov 15 '16 at 09:41

1 Answers1

2

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

colin aygalinc
  • 457
  • 4
  • 13
  • True. For some reason, it works again when I dumped and added a version to the appropriate . I guess I got too much used to autocomplete and spellchecking. I corrected the error inadvertently when I copied over autogenerated pom lines from JitPack to add the dependency. – Sargon1 Nov 15 '16 at 10:00