Can't build Maven project in Netbeans due to dependencies - maven

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.

Related

Failed to collect dependencies maven

getting this error when trying to maven install
Failed to execute goal
org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default-jar) on
project AbacusLibraryServer: Execution default-jar of goal
org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar failed: Plugin
org.apache.maven.plugins:maven-jar-plugin:3.1.2 or one of its
dependencies could not be resolved: Failed to collect dependencies at
org.apache.maven.plugins:maven-jar-plugin:jar:3.1.2 ->
org.apache.maven.shared:file-management:jar:3.0.0: Failed to read
artifact descriptor for
org.apache.maven.shared:file-management:jar:3.0.0: Could not transfer
artifact org.apache.maven.shared:file-management:pom:3.0.0 from/to
central (https://repo.maven.apache.org/maven2): Transfer failed for
https://repo.maven.apache.org/maven2/org/apache/maven/shared/file-management/3.0.0/file-management-3.0.0.pom:
Received fatal alert: protocol_version -> [Help 1]
i can see a lot of .lastUpdated files in maven.
tried using maven clean and then maven install.
i tried deleting all these files and doing maven force update using eclipse not working.
what is working is downloading every jar file one by one from maven repository already done for around 20 but there are still more and no idea how much isn't there a easier way.
also not using any proxy tried using mobile network and personal wifi.

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

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

How can I get Restlet via Maven when I am behind a proxy?

I tried their official sample pom at here and got the following error:
[ERROR] Failed to execute goal on project myproject: Could not resolve
dependencies for project com.example:myproject:jar:1.0-SNAPSHOT:
Failed to collect dependencies at org.restlet.jse:org.restlet:ja
r:2.3.4: Failed to read artifact descriptor for
org.restlet.jse:org.restlet:jar:2.3.4: Could not transfer artifact
org.restlet.jse:org.restlet:pom:2.3.4 from/to maven-restlet
(http://maven.restlet.com ): Not authorized ,
ReasonPhrase:Unauthorized. -> [Help 1]
Some investigation I have done:
I am not using a company mirror. I used to use but to debug this I disabled it, because our company mirror does not have this.
Non-Restlet components works fine with the proxy configuration I put in settings.xml. I am trying Camel examples btw.
Non-Restlet components will get a similar error if I use a incorrect password for the proxy.
I tried a mirror mentioned here and it does not work.
So it seems restlet specific, but I have run out of ideas.

maven failing on dependency that isn't actually in the project

My build is failing with this error message (corporate stuff crossed out):
[ERROR] Failed to execute goal on project XXXX: Could not resolve
dependencies for project XXXX: The following artifacts could not be
resolved:
com.github.chrisbanes.actionbarpulltorefresh:library:jar:0.9.3,
com.github.castorflex.smoothprogressbar:library:jar:0.2.0: Cannot
access XXXX-release (http://repo.XXXX.corp/main/repo) in offline mode
and the artifact
com.github.chrisbanes.actionbarpulltorefresh:library:jar:0.9.3 has not
been downloaded from it before. -> [Help 1]
The funny thing is that actionbarpulltorefresh is not a dependency of this project. I double-checked and the string appears nowhere in the directory. It's a dependency of another project I built a couple of days ago, but not this one. It's also not mentioned in my users's settings.xml file, or anywhere in .m2 except that it's actually installed there.
Where could that error possibly be coming from?
It might be a transitive dependency, a dependency of a dependency.
This question might help you: How to determine which Maven dependency is needing a missing dependency?

Maven - unable to download dependencies behind Proxy Error Code - 307 Temporary Redirect

I am using Maven to run a Java project. My issue is that I am not able to download the dependencies. It is giving the following error
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.7.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.7.1: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2): Failed to transfer http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.pom. Error code 307, Temporary Redirect -> [Help 1]
The settings.xml is properly configured with the proxy details (since I am behind a proxy) Still, I am not able to access the maven repo to download.
UPDATE: Thanks a lot landal79.I revisited this issue after some time. Still this issue gives me a nightmare.
Currently, I am not able to create any Maven Project. I am 100% sure this is due to a proxy issue. But not able to
nail it down to where exactly the issue.
When I try creating a project selecting an archetype, I am not able to create a maven project. I am getting the below error
"Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-
quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\rrr.m2\repository)
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\rrr.m2\repository)"
I try creating this project through Eclipse. The settings.xml point to the right proxy ( cross checked with the Network connections dialog (window ->General->NetworkConenction Dialog). But the issue still persists.
So what I did was installed standalone Maven and create a maven project from command prompt. To my surprise,I am not able to download the archetypes in Maven Repo though other plugins are getting downloaded (Surefire plugin and JUNit jar for example)
Is there any work around to resolve the archetype download issue?
I tried your solution, but the issue still persists. When I create a simple maven project (without using any archetypes) I am getting "Unable to build Project " Error
PS: The proxy settings are defined in settings.xml and they are correct. Also, the eclipse proxy settings are correct (Since I am able to install plugins from Eclipse MarketPlace)
Eclipse experts - please help me resolve this issue. Thanks a lot in advance for help.
Thanks

Resources