Not able to create maven project under eclipse mars even after setting the proxy - spring

Hi Everyone ,
I am new to Maven environment . Tried all possibilities of enabling the proxy under settings.xml .But no use. Since the maven is integrated in mars I couldn't find the settings.xml and created my own under .m2 . And also tried with the external maven also .But no results .
Below is my settings.xml .
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>hostname</host>
<port>port</port>
<username></username>
<password></password>
<nonProxyHosts></nonProxyHosts>
</proxy>
</proxies>
</settings>

The failed request from before has been cached by Maven. You need to run the command with the -U flag to retry. (Or wait until the caching has expired...)

Related

How to make maven search for artifacts in local repository

I have a project that worked fine on another pc. And now i'm trying to run it on another pc. There is no acces to proxy. And after any action it says that
couldn't transfer artifact. no route to host
But i have all depandencies in local repository, maven just doesn't want to take it from there. Is there a way to make him take all artifacts from local repo first?
There must be a version difference in the artifacts you have in your local repository and the ones mentioned in pom.xml
Your error : couldn't transfer artifact. no route to host
is because you have'nt added proxy to your pom. eg :
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
-->
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>username</username>
<password>yourpassword</password>
<host>yourhost#host.com</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
Add it to the settings.xml file in conf folder of maven and try again

Maven Archetype generate proxy issue, searching for remote catalog

Maven seem to be having a bug related to proxy when fetching archetype from maven's remote catalog.
My computer is behind a proxy server. I am trying to generate a project from maven command line.
D:\test>mvn archetype:generate -DarchetypeArtifactId=scala-archetype-simple -DinteractiveMode=false -DgroupId=com.sparktest -DartifactId=myspark -DarchetypeGroupId=net.alchim31.maven -DarchetypeVersion=1.6 -DarchetypeCatalog=remote -e -X
[DEBUG] Searching for remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml
[DEBUG] Archetype org.apache.maven.archetypes:scala-archetype-simple:1.6 doesn't exist
org.apache.maven.archetype.downloader.DownloadNotFoundException:
Requested org.apache.maven.archetypes:scala-archetype-simple:jar:1.6 download does not exist.
Below Eclipse Bugs are related, however the issue seems to be with maven rather than Eclipse.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390183#add_comment
Please note there is no issue working on existing maven project. The dependencies get downloaded without any issue once maven proxy is configured in settings.xml. The issue comes when generating a project using archetype:generate and using maven remote archetype-catalog.
Maven archetype-catelog can be opened in a browser without any issue
http://repo.maven.apache.org/maven2/archetype-catalog.xml
It's seems that scala-archetype-simple archetype with groupId org.apache.maven.archetypes doesn't actually exist.
You should try one of these :
net.alchim31.maven
org.scala-tools.archetypes
I had this exact issue and the following worked for me: have two proxies, one for http and one for https.
<proxy>
<id>my-proxy-http</id>
<active>true</active>
<protocol>http</protocol>
<host>xx.xx.x.xxx</host>
<port>8080</port>
<username>myusername</username>
<password>mypassword</password>
</proxy>
<proxy>
<id>my-proxy-https</id>
<active>true</active>
<protocol>https</protocol>
<host>xx.xx.x.xxx</host>
<port>8080</port>
<username>myusername</username>
<password>mypassword</password>
</proxy>

Unable to get external maven dependencies for Junit and Selenium in IntelliJ

I'm not sure if the issue of not being able to sync the dependencies is to do with proxy or firewall.
I have been trying to make it work but no joy.
Is there any solution for someone in my situation?
I have, reinstall, imported project, run maven clean and install in cmd but still no dependency has been imported.
Message displays 'Dependency "org.seleniumhq.selenium-java:2.53.0" not found'
I believe I found the answer. The issue is indeed proxy and by adding those lines in the settings.xml between with your/company proxy details it should work.
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>xx.xx.x.xxx</host>
<port>1234</port>
<nonProxyHosts></nonProxyHosts>
</proxy>
</proxies>
In some instances you may need to add the username and password to make it work.
<username></username>
<password></password>

No plugin found for prefix 'install' in the current project

I want to add jdbc oracle to maven repository since it is not in repository, I have to run this command:
mvn install:install-file
-Dfile=D:\Temp\ojdbc6.jar
-DgroupId=com.oracle
-DartifactId=ojdbc6 -
Dversion=11.2.0 -Dpackaging=jar
and run into this error:
[ERROR] No plugin found for prefix 'install' in the current project and in the p
lugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the re
positories [local ({my repository path}), central (https://repo.maven.
apache.org/maven2)]
any help would be appropriated.
I recently got the same error and I tried this command. It worked.
export MAVEN_OPTS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2
I have faced the same issue, there is a two-step process to resolve this issue:
Configure Maven Proxy Configuration
Open Maven configuration file:
For Linux: ${user.home}/.m2/settings.xml
For Windows: C:\users\username\.m2\settings.xml
If you could find the file open it and search for <proxies></proxies> the segment.
If you cannot find the file, create a new file called settings.xml and add following xml tags <settings></settings>
Add the proxy configurations as below:
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
Update Maven Libraries with a Working Extension
Wagon HTTP lightweight library allows us to connect through NTLM proxies. This can be added as an extension to default Maven libraries.
Download the wagon-http-lightweight-2.2.jar from
https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-2.2.jar
Copy the downloaded file to %M2_HOME%/lib/ext folder.
Now you are ready to use Maven with your programs.
Try adding this to your Maven configuration file:
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
It should install Oracle JDBC to your repository and should install the necessary JARS.
https://www.tech-recipes.com/rx/39256/add-dependencies-to-maven-pom-xml-file/
Add it within the dependencies tag.
Hope it helps!
[ERROR] No plugin found for prefix ‘install’ in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/amitkumar/.m2/repository), central (https://repo.maven.apache.org/maven2)]
There are 2 steps we need to follow to fix this issues :
Step 1 : Open Maven configuration file: For Linux: ${user.home}/.m2/settings.xml
If you could find the file open it and search for the segment.
If you cannot find the file, create a new file called settings.xml and add following xml tags
Add the proxy configurations as below:
<settings xmlns="http://maven.apache.org/settings/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>www-proxy.us.oracle.com</host>
<port>80</port>
<nonProxyHosts>adc2170275|*.oracle.com|*.oracleads.com|*.us.oracle.com|
*.uk.oracle.com|*.ca.oracle.com|*.oraclecorp.com|
*.oracleportal.com
</nonProxyHosts>
</proxy>
</proxies>
</settings>
Step 2:
Update Maven Libraries with a Working Extension
Wagon HTTP lightweight library allows us to connect through NTLM proxies. This can be added as an extension to default Maven libraries.
Download the wagon-http-lightweight-2.2.jar from https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-
2.2.jar
Copy the downloaded file to %M2_HOME%/lib/ext folder.

Specifying proxy for cxf-codegen-plugin

How do you specify a proxy that needs to be used by cxf-codegen-plugin. I tried specifying proxy in the maven settings.xml, but that was not picked up.
maven settings.xml in ~/.m2 folder works just fine for me for cxf-codegen-plugin. Example:
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username><!-- username --></username>
<password><!-- pass --></password>
<nonProxyHosts>*.local|*.example.com</nonProxyHosts>
</proxy>
</proxies>
I've tried:
mvn -Dhttp.proxyHost=[_] -Dhttp.proxyPort=[_] clean package
([_] -> Your proxy data)
On console and worked.

Resources