Glowstone install: Maven peer not authenticated / could not resolve dependencies error - maven

I was closely following the ‘Building’ instructions from the readme for Glowstone https://github.com/GlowstoneMC/Glowstone
but whenever I try ./setup.sh, it fails building with this stack trace:
Failed to execute goal on project glowstone: Could not resolve dependencies for project net.glowstone:glowstone:jar:1.10.2-SNAPSHOT: Failed to collect dependencies for [net.glowstone:glowkit:jar:1.10.2-R0.1-SNAPSHOT (compile), com.flowpowered:flow-network:jar:1.1.0-SNAPSHOT (compile), jline:jline:jar:2.11 (compile), org.projectlombok:lombok:jar:1.14.8 (provided), net.sf.trove4j:trove4j:jar:3.0.3 (compile), co.aikar:fastutil-lite:jar:1.0 (compile), org.jetbrains.kotlin:kotlin-runtime:jar:1.1-SNAPSHOT (compile), org.jetbrains.kotlin:kotlin-reflect:jar:1.1-SNAPSHOT (compile), io.netty:netty-transport-native-epoll:jar:4.1.0.CR7 (compile), junit:junit:jar:4.12 (test)]: Failed to read artifact descriptor for net.glowstone:glowkit:jar:1.10.2-R0.1-SNAPSHOT: Could not transfer artifact net.glowstone:glowkit:pom:1.10.2-R0.1-SNAPSHOT from/to glowstone-snapshots (https://repo.glowstone.net/content/repositories/snapshots/): peer not authenticated -> [Help 1]
I tried looking at the maven website for some hints on DependencyResolutionException and peer not authenticated error, but it didn't help. Anyone please help me, I've been stuck for a couple weeks with no progress.

I tried the same instructions and was able to reproduce your error exactly.
The problem seems to be with maven not being able to communicate securely with the repositories specified in the pom; see this answer.
After some fiddling, I was able to get the build.sh script (which is just running mvn package) to run successfully. The main idea is to lock down the dependency versions in the pom to non-SNAPSHOT versions, so that none of them need to be retrieved from those problematic repositories.
These steps should get you to a working build:
In the pom, change the kotlin-runtime and kotlin-reflect dependency versions from 1.1-SNAPSHOT
to 1.0.4.
Change the flow-network dependency version from 1.1.0-SNAPSHOT
to 1.0.0.
Download glowkit-1.10.2-R0.1-20160907.003121-11.jar and glowkit-1.10.2-R0.1-20160907.003121-11.pom and put them in the right place in your local repo (for me, that was ~/.m2/repository/net/glowstone/glowkit/1.10.2-R0.1-SNAPSHOT/)
Now you can change the value of the bukkit.version property in the pom from 1.10.2-R0.1-SNAPSHOT to 1.10.2-R0.1-20160907.003121-11
Similarly, download fastutil-lite-1.0.jar and fastutil-lite-1.0.pom from http://ci.emc.gs/nexus/content/repositories/aikar/co/aikar/fastutil-lite/1.0/, and place them in your local mvn repo (~/.m2/repository/co/aikar/fastutil-lite/1.0/)
NOTE that doing this much should have resolved all of the problems with downloading the dependencies, so at least something like mvn dependency:tree should run successfully.
Finally, even after resolving those dependency issues, there is a compilation problem because of the version of netty being used. Change the dependency version for netty-transport-native-epoll from 4.1.0.CR7 to 4.1.5.Final. Also you will have to add this explicit dependency on netty-all, since otherwise, flow-network will pull in an earlier version:
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.5.Final</version>
</dependency>
That should do it! After those steps, the mvn package, and so the setup.sh script, ran successfully for me.

This error is caused by an incompatibility in the SSL stack connecting to repo.glowstone.net.
Downgrading dependencies to avoid connecting to the Glowstone repository may avoid this particular problem, but creates other problems, and does not currently work on the latest Glowstone build since it requires the snapshot dependencies (see GH-467 on GitHub GlowstoneMC issue tracker) and also from discussion with Glowstone developers, and my own testing, downgrading now causes a different error: java.lang.IllegalAccessError: class lombok.javac.apt.Processor (in unnamed module #0x18c23b6))
Maven's error message peer not authenticated doesn't explicitly say so, but it is caused by repo.glowstone.net requiring the Server Name Indication (SNI) extension (needed by Cloudflare Flexible SSL), which older versions of Maven do not support. You can verify this by performing an SSLLabs scan on this server, which reports "This site works only in browsers with SNI support.", and capturing the SSL handshake in Wireshark which shows the server drops the connection after the first Client Hello, without server_name:
Wireshark capture demonstrating missing Extension: server_name
Wireshark capture demonstrating server closing connection
The fix is simple: upgrade to a version of Maven supporting SNI. In my case I had Maven 3.0.5 but updating to Maven 3.5.0 from maven.apache.org fixed the problem and I was able to build Glowstone without a hitch.
You can check the version of Maven you have with mvn -version, it should show something like this (the critical versions for Glowstone are Apache Maven 3.5.0+ and Java version: 1.8.0_131):
Glowstone $ mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00)
Maven home: /Users/admin/.m2
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8

Related

How to fix not finding a plugin artifact?

I am getting this error: [ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4 in nexus-xyz-plugin
I tried to run maven with dependecy:tree, but I can't see surefire, and I dont know why it is looking for this specific version 2.12.4 which is not specified in my pom!
Even the surefire plugin is not defined in my pom, but I have the assembly plugin not sure if assembely is dependent on surefire
Note that I only get the error when running mvn package, however when running mvn compile the build succeeds
Version 2.12.4 of the maven-surefire-plugin is always added to the pom by maven version 3.x unless you depend on a specific other version.
Maven has a so called super pom that you get for free, but that doesn't list surefire: https://maven.apache.org/ref/3.8.5/maven-model-builder/super-pom.html
However it is added to the pom, i've checked this with maven 3.3.9. You can verify this by running mvn help:effective-pom.
Reference with the same problem: No surefire plugin in my pom - How does it show surefire output?
These plugin versions are part of the default bindings for lifecycle executions, in this case of the test phase. So these plugins are always included if not specified.
See for reference:
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
https://maven.apache.org/ref/3.8.5/maven-core/default-bindings.html
Maven default life-cycle and plugins section
Normally this plugin should be available in maven central, check if you have a <pluginRepository> in your (effective) pom that references https://repo1.maven.org/maven2/
Some other things you can check:
Open the file .m2\repository\org\apache\maven\plugins\maven-surefire-plugin\2.12.4\maven-surefire-plugin-2.12.4.jar.lastUpdated and check the error message for each repository. Check why it can't reach maven central; is it missing from the list or giving an error? This might be a company firewall/policy issue perhaps? Or is it giving an error on HTTPS/TLS protocol level?
Check if you can add maven central to your repositories list if it's missing somehow (should be included by default). Check if it's HTTP or HTTPS, only secure is supported now.
Run your maven command with -X for debug mode to investigate further
An alternative is to add the latest version of surefire to your project that is available in your plugin-repository, and perhaps disable it if you're not executing unit tests.
See Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.

AEM Mocks missing artifact for latest version

I have added the latest version of AEM Mocks (2.7.2) as a Maven dependency in my AEM project. When I try to build my project, I get an error saying that this artifact cannot be found: com.day.commons:day-commons-gfx:jar:2.1.28. So I looked online, found it and added it as a dependency. But now I get the same error when trying to build. Does this artifact still exist? When trying various recent versions of AEM Mocks, I found that they all depend on this missing artifact.
For now, I downgraded to version 2.3.0, which works fine without that artifact but I would like to use the most recent version if possible.
Can anyone please help? Thanks!
This artifact is defined as a workaround, it is explained here in comment:
https://github.com/wcm-io/wcm-io-testing/blob/develop/aem-mock/core/pom.xml#L254:
Workaround for AEM 6.5: The new uber-jar does no longer contain the package com.day.imageio.plugins
It works without any issues for me, so I would check if you have correctly configured Maven repositories. To do it, in your Maven project root type:
mvn help:evaluate
and then:
${project.repositories}
It should list your project effective repositories. Ensure that there is Central Repository (https://repo.maven.apache.org/maven2/) listed. If it is there, then maybe your corporate network cuts requests to external repositories or it was temporarily down.

Can not build the project after upgrading to mule version 3.8.4 to 3.7.4

Previously I was building the project with the mule version 3.7.4. now, as mule version 3.8.4 is the latest one, so planned to build with this latest version. So,
from Anypoint Studio I have downloaded the latest version.
Then I updated my POM file with the 3.8.4 version. But it seems that with the same jars its not able to build the project.
Its gives error as
Failed to execute goal on project sho-pointofsales: Could not resolve dependencies for project com.sho:sho-pointofsales:mule:1.0-SNAPSHOT: Failed to collect dependencies at com.mulesoft.muleesb.modules:mule-module-tracking-ee:jar:3.8.4: Failed to read artifact descriptor for com.mulesoft.muleesb.modules:mule-module-tracking-ee:jar:3.8.4: Could not transfer artifact com.mulesoft.muleesb.modules:mule-module-tracking-ee:pom:3.8.4 from/to mule-ee-releases (https://repository-master.mulesoft.org/nexus/content/repositories/releases-ee/): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
Although I placed this jar inside my local REPO. Don't know what is wrong I am doing.
Thanks in advance.
It exists: https://repository.mulesoft.org/nexus/content/repositories/releases-ee/com/mulesoft/muleesb/modules/mule-module-tracking-ee/
check your username and password in your settings.xml or pom etc for that repo.
But it's part of the platform anyway and doesn't need to be explicit in your pom. So just remove it from the pom or set it the scope to 'provided' on the dependency
Check following stuff:
a. You can either comment the enterprise repository in the pom.xml file.
b. Check if the enterprise repository is accessible from your browser.
c. verfiy username and password.

Maven Could not resolve dependencies

Now, i have a project which runs fine on my windows computer. But after I copied it to a linux computer, when compiling it reports following error:
Failed to execute goal on project alert: Could not resolve dependencies for project com.cloud.ras:alert.
The POM for com.external:commons-logging:jar:1.0.4.1 is missing, no dependency information available
The POM for com.external:freemarker:jar:2.3.4 is missing, no dependency information available
The POM for com.external:log4j:jar:1.2.14 is missing, no dependency information available
The POM for com.soa.lib:eBoxServiceCommon:jar:2.5.3 is missing, no dependency information available
but i have copied these jars to the maven repository. And can anyone give me a help?
You should NOT copy JARs in the first place. That's Maven job to resolve the dependencies for you.
It would be helpful if you explain the reason why you need to use your own groupId e.g. com.external in the first place i.e. commons-logging is from Apache but you use com.external as its groupId.
If you really insist on wanting to use your own groupId, at least download the JAR and install it using Maven. See here:
http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html.

Can't build Maven project in Netbeans due to dependencies

I have a problem when building my Maven project in Netbeans. When on my stationary computer it works just fine, but on my laptap I cant get it to work. I get the following error:
Failed to execute goal on project SnakeAppWebpage: Could not resolve dependencies for project se.chalmers.snake:SnakeAppWebpage:war:1.0: Failed to collect dependencies for [org.apache.derby:derbyclient:jar:10.6.1.0 (compile), org.eclipse.persistence:eclipselink:jar:2.2.0 (provided), org.eclipse.persistence:javax.persistence:jar:2.0.3 (provided), org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:jar:2.2.0 (provided), javax:javaee-web-api:jar:6.0 (provided), junit:junit:jar:4.8.2 (test)]: Failed to read artifact descriptor for org.eclipse.persistence:eclipselink:jar:2.2.0: Could not transfer artifact org.eclipse.persistence:eclipselink:pom:2.2.0 from/to eclipselink (http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo/): Error transferring file: Connection timed out: connect -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
I've already added all the jar files manually but it still doesn't work. I have the same OS and Netbeans version on both computers. Also when I try to build the project on my laptop Netbeans tries to download the dependencies from the specified repositories before showing me the error. The repositories URL's are valid. When building on my other computer it doesnt do this BS, it just launches the application.
Maven only needs to download any specific library/dependency one time per machine. On your desktop computer it probably downloaded these repositories at some point in the past and has them still stored on your computer. However, on your laptop it looks like it is having trouble retrieving the repositories from the remote store (check your internet connection? "Error transferring file: Connection timed out" appears to be the pertinent error). If you have added the jars manually, make sure you added them in the correct maven repository location and followed the proper directory structure.

Resources