Maven dependencies fail to download - java

I am working in a corporate network.
I can't download artifacts through maven, but I can download them individually through my web browser.
This is the error:
[ERROR] Non-resolvable import POM: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.9.8 from/to central (https://repo1.maven.org/maven2): Can't connect to SOCKS proxy:Connection refused: connect # org.springframework.boot:spring-boot-dependencies:2.1.3.RELEASE, C:\Users\alfonso\.m2\repository\org\springframework\boot\spring-boot-dependencies\2.1.3.RELEASE\spring-boot-dependencies-2.1.3.RELEASE.pom, line 605, column 25
For what I have googled, a lot of people solve this configuring a proxy. I don't understand why I would need that, because as I said, I can download the dependencies trough my web browser.
If configuring a proxy is the only way, any idea as to how to identify my company's proxy?? I've no idea what it is.
Is it supposed to be a "maven proxy" or just a simple proxy? I ask because IT people probably don't know much about java and maven. So if I ask them what is our maven proxy, they may not know what I'm talking about (if it is something at all he he)

Downloading the dependencies through a browser is a nightmare because standard Maven projects need hundreds of artifacts (Maven plugins etc.).
The proxy is not a "Maven proxy", but a company thing. You need to find out which proxy allows access to MavenCentral. If you don't have such proxy, you need to discuss a solution like e.g. setting up your own Nexus/Artifactory and giving it access to MavenCentral.

Related

My Springboot Dependency can't be found for some reason

So I'm using Intellij and I am connecting to the internet via a proxy server. For some reason on my regular computer connected via wireless router it all works out but this one isn't working. I tried reloading the maven project, but to no avail.
For some reason pom.xml can't find my dependencies, and that's probably why.
This is the pom.xml: Top of pom.xml
Bottom of pom.xml
This is the problems tab in the console: Here
If you are using IntelliJ's embedded Maven, configure your proxy as per this [link]1.
You can copy the default settings.xml file from Maven install ${maven.home}/conf/settings.xml to ${user.home}/.m2/settings.xml.
Then, add a proxy section to your settings file as in explained in this guide.
Also, check with your company's infrastructure responsible that you are actually allowed to connect to Maven Central, for example at my current company we have a well-known brand firewall that, by default, blocks it.

Maven proxy configuration with Nexus

I am using Nexus and have configured maven-proxy and maven-hosted repositories, added them to a group repo and using that repo through settings.xml. Now when a new dependency is added in pom, maven-proxy goes to maven central and downloads it. However, I do not want this.
My goal is to stop replying on Maven central completely, but I know it won't work until my hosted repository contains everything that maven needs.
Issue is that Maven plugins like compiler, clean, jar etc. downloads tons of dependencies on its own. If I remove connection to maven proxy, how do I get all that list and then how do I make sure that I put whatever is needed in my hosted repository ?
Should I even try to put such artifacts in my hosted repo ? Is there any other better approach ?
You cannot really do that manually, the number of artifacts is way too large.
You can let Maven download all needed artifacts, then copy that from a remote to a hosted repository and work with that (until you need something new).
But it is still painful. I would not do that.
If your concern is security, I would use an open source security scanner instead of blocking internet access altogether.

Intellij idea, can't make Maven work

It's a copy of this post with adding information (because it's not a copy of another questions like this).
I just instaill last version of Intellij idea on the new computer and can't make Maven work properly with empty project.
When it starts Maven try to download all it's plugins, but it stuck in infinite download. I try to add some dependcy and get infinity download of that dependcy
I have found a lot of peoples with such problems like this and a lot of others, but this solution doesn't work for me.
I already install last version of Maven instead of Maven inserted in idea:
Also I try to update information from main repository manual in idea Maven settings and got such error:
transfer for nexus-maven-repository-index.properties failed
There is post with problem like this, but it doesn't work for me either.
And if I try to use Maven from Terminal like this:
mvn -U idea:idea
(also I try to add proxy settings as arguments here) I've got such problems:
Failed to retrieve plugin descriptor for
org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin
org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its
dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
And a lot of problems like this with other plugins.
Try to use proxy in settings.xml and as commands in idea settings of Maven:
As #Tunaki already said add of proxy helped in most of cases, but not mine.
My settings.xml:
I found the problem. The connection was being blocked my the computer's firewall. Turning off Windows Firewall and Avast Internet Security makes it work without any proxy.

registering custom maven archetype

How can I register my own Maven archetype, co that other people (in the whole world or just in my local company) might use it?
In Python, there is PyPI, a global registry where you create packages, upload them, upgrade, ... and you've got a user there which you use to authorize your self.
In node.js, there is npm, which works exactly the same. There is also bower, which is similar (though it relies on git branches).
Anyway, this tutorial describes that I can install an archetype locally. But how can I make it public, so that other people may download it? How is it integrated with IDEs (Eclipse, NetBeans, etc.)?
Publish your archetype (or any other artifact) to the Central Repository via Sonatype OSS Repository Hosting.

Nutch 2.2.1 build stuck issue

I am having issues building Nutch 2.2.1 behind my company firewall. My build gets stuck here:
[ivy:resolve] :: loading settings :: file = ~/nutchtest/nutch/ivy/ivysettings.xml
When I contacted the hosting admin, they said - "Ant is trying to download files from internet and it will have problems with our firewalls. You will either have to download the files yourself and then scp/sftp them to the machine. Unfortunately we don't have an http proxy."
From further digging, I could see Ant is trying to access this link http://ant.apache.org/ivy/. Could anyone please advise what I should do to make Ant compile Nutch without accessing the internet? I can download required files from http://ant.apache.org/ivy/ and scp/sftp to the server but I am not sure what files to download and where to put them?
Run the build on a machine connected to the internet. Ivy will cache your build's dependencies here (by default):
$HOME/.ivy2/cache
A populated cache will enable you to repeat the build inside your firewall.
I would also suggest enhancing the build to run the ivy report task. This will produce webpage listing the dependency tree. If you want to build a local repository this information is very useful.
Finally consider running a repository manager inside your firewall. Tools like Nexus and Artifactory make repository hosting a lot simpler to manage. Consider obtaining a firewall exception for this server. Repository managers are used to cache useful internet repositories like Maven Central.

Categories