Maven proxy vs mirror - maven

I am finding it difficult to understand the difference between a mirror and a proxy defined in the settings.xml. I read that whatever a defined mirror is a mirrrorOf, all http requests to those(mirrorOf) repositories are overridden by a corresponding http request to the mirror. What is a proxy then? This question is in the wake of troubleshooting the following error I receive while I try to create a new project using mvn archetype:generate.
The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not
exist or no valid version could be found
Any help?

Proxy configuration relates to a standard HTTP proxy you might need reaching Internet, such as a proxy in your web browser. It does not relate to maven functionalities as such, but to reaching Internet connectivity.
If you can use a browser without a proxy, you probably don't need one for Maven either, and vice versa.
Mirror configuration, on the other hand, is meant to replace a maven repository with another. They are not related to connectivity - they change the target which your maven tries to reach.

Related

Maven Nexus V3 wont work with artifactory as a remote repo. How can I get around this issue?

So I currently am trying to get artifacts from repo.osegeo.org, which is a Nexus V3. I am having issues getting the artifacts to populate into my virtual repo that i created which holds the remote osegeo repo, libs release, libs snapshot and also my local repos. I have tried following the work around that is stated in this link below:
https://community.sonatype.com/t/maven-nexus-v3-remote-repository-integration-with-artifactory/2149
But I still have trouble actually getting the artifacts in my repo. Any ideas on what to do?
I suggest checking the following:
Connectivity - Is Artifactory able to reach the Nexus repository and vice versa?
The URL which is configured and if it is configured correctly.
Enable Bypass HEAD requests on the remote repository - Nexus can block HEAD requests and by default, Artifactory will create HEAD requests first before the GET requests to check if the artifact exists before attempting to resolve it.
If the Nexus repository requires authentication - Do not forget to put username and password under the advanced tab.
If there is also a reverse proxy in front of Nexus, you can try to bypass it and check if this works, if it does, the problem is probably the RP.
Check if the Maven client is configured correctly to work against the virtual repository (You didn't mention if you are able to publish or fetch from the local repository).

proxy repository is blocked

I added a proxy repository in nexus. When I update now in Routing, it failed. The repo url I added is https://raw.githubusercontent.com/dianping/cat/mvn-repo
I can access this url
https://raw.githubusercontent.com/dianping/cat/mvn-repo/org/unidal/maven/plugins/codegen/2.3.2/codegen-2.3.2.pom
I can't access this url
https://raw.githubusercontent.com/dianping/cat/mvn-repo
response 400: Invalid request
So. It's the repo server block nexus from update.
If I don't use mirror in maven setting, Maven update will work right.
Meanwhile, when I use nexus public repositores group as my mirror(I also added proxy repo to public repositories group), It just report Failure to find org.unidal.maven.plugins:codegen-maven-plugin:jar:2.3.2
in http://172.xxx/nexus/content/groups/public
How can I solve this problem?
And I guess the maven resolve flow is like:
maven resolve a dependency
find the dependency in local
find in repo manager
find in proxy repo.
As the full url like https://raw.githubusercontent.com/dianping/cat/mvn-repo/org/unidal/maven/plugins/codegen/2.3.2/codegen-2.3.2.pom can be access, repo manager could fetch the specific pom url, if my guess is right.
I wonder: Unlike maven central,which you can access its index or called file tree, this cat.repo you can only access its file but not its directory. So what's the diffenrence in maven? How to handle this?
EDIT
Because I've successed update not using <mirrorOf>*</mirrorOf>. My local repository already download these missing plugins in Nexus. So I follow the tips in Maven not using the local repo, and that missing plugin does not cause error again, but another artifact not found in nexus again.
I also do as maven missing artifact shows, by
Deleting maven-metadata*.xml and _*.repositories inside local
Still not working.
The remote is returning HTTP code 400 (invalid request) for request to "/".
Nexus does HEAD and GET requests to the root URL to determine if the remote is reachable, and in good health. This response code is causing Nexus to think the remote is not working.
To work around this, go to the proxy repository's configuration tab and set "auto-blocking enabled" to "false".
You can also get this failure if you are doing an http request to a server that only allows https.

ArtifactTransferException: Could not transfer artifact ... to/from central

I'm following this tutorial: Spring - DAO and Service layer
I'm getting this error in Eclipse on my pom.xml:
ArtifactTransferException: Could not transfer artifact org.antlr:antlr:jar:3.2
from/to central (http://repo.maven.apache.org/maven2): No response received
after 60000
Any ideas why?
This sounds like a simple networking issue. I would recommend you attempt to access that URL in your web browser to confirm you have connectivity: http://repo.maven.apache.org/maven2. You should see:
Browsing for this directory has been disabled.
View this directory's contents on http://search.maven.org instead.
You may also wish to check that your local system does not require a proxy to access the Internet. If so, you need to follow these instructions to configure Eclipse to use your proxy.

Cargo deploy uses proxy settings when it shouldn't

I'm using cargo to deploy my project to a test server. The cargo config is fine, works well on my local machine. However, on the hudson machine it always fails with a stacktrace showing:
Caused by: java.io.IOException: Server returned HTTP response code: 407 for URL: http://ppdtest.kbcsecurities.net:8080/manager/text/list
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1313)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:507)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:644)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:657)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:173)
... 34 more
The thing is however, I have NO proxy defined anywhere. Not in my setting.xml, not in the pom.xml files (parent or childs).
Anyone has some pointers or help to offer?
Are you sure that this is a proxy problem? The URL looks like it's Tomcat's Manager application. Can you verify that you're using the right credentials for your Tomcat instance?
If you want to make sure that no proxy is involved, please check the environment variables of the machine to see whether there's any global proxy setting that Java could be picking up, either in the global Maven options or in the options for Hudson.
One other thing to try is whether you can access the URL in question using a browser from the Hudson machine. If it's a headless machine, you can use a terminal browser like links and see if you can authenticate with that.

Free artifactory or nexus service url without password, for using in intellij idea

Intelliji Idea shiped with 3 free online repository in settings -> maven -> artifactory or nexus service url
http://oss.sonatype.org/service/local/
http://repo.jfrog.org/artifactory/api/
https://repository.jboss.org/nexus/service/local/
all this repos are unavialable (404 error or password protected).
Can you give more free artifactory or nexus service url without password protect?
IDEA has no settings for password on repo URL.
The service URLs are used for attaching remote libraries to a module by running class search queries using the REST APIs available at those URLs and downloading the found librarie from the remote Artifactory.
The REST URLs aren't meant to be directly browsable.
Maybe this explains it better: http://blogs.jetbrains.com/idea/2010/08/getting-external-libraries-easily/
IDEA uses the REST services to get listings of all the repositories available on each host. All three work for me on my machine which is on a network without an HTTP proxy. Is it possible you are on a network with a proxy?
Those urls appear to be pointed at the REST resources of each system, they aren't repositories, not sure what the intellij guys were attempting to do.
If you need a repo to host your own stuff in for free, see here: http://nexus.sonatype.org/oss-repository-hosting.html
If you are trying to access the repositories on Nexus, then you can find them by browsing http://oss.sonatype.org or https://repository.jboss.org/nexus/
Sonatype's service URL now only supports https, so if you're not finding expected artifacts, try updating your Intellij Idea Maven > Repositories setting to https://oss.sonatype.org/service/local/

Resources