I am building my project using maven I am getting following error ...can any one tell why it is happening? My internet connection is ok is there any proxy setting problem?
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-ftp/1.0-beta-6/wagon-ftp-1.0-beta-6.pom
[WARNING] Unable to get resource 'org.apache.maven.wagon:wagon-ftp:pom:1.0-beta-6' from repository central Error transferring file: Connection timed out
You can find the following proxy setting template in the Maven configuration file , which is located at MAVEN_HOME_DIR\conf\settings.xml
<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>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>
Did you configure the proxy setting ?
Reference
Maven - Guide to using proxies
Related
I am trying to setup a maven project via eclipse,but it is throwing following error.
Multiple annotations found at this line:
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact
descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/
to central (https://repo.maven.apache.org/maven2): Connection refused: connect
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact
descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from https://
repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could
not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): Connection refused: connect
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-compile)
- Connection refused: connect
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)
pom.xml:
<project xmlns="maven.apache.org/POM/4.0.0"; xmlns:xsi="w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="maven.apache.org/POM/4.0.0 maven.apache.org/xsd/maven-4.0.0.xsd">; <modelVersion>4.0.0</modelVersion> <groupId>MavenRep</groupId> <artifactId>om.spring.learnings</artifactId> <version>0.0.1-SNAPSHOT</version> <name>SampleSpringBoot</name> </project>
Following is my settings.xml
settings.xml:
<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> myhostname</host>
<port>9080</port>
<username>xxx</username>
<password>xxxx</password>
<nonProxyHosts>80</nonProxyHosts>
</proxy>
</proxies>
</settings>
I'm trying to build the Eclipse Kura project from behind a corporate firewall.
When I try to build kura/examples/org.eclipse.kura.example.camel.aggregation (mvn clean install), it ends with :
Internal error: java.lang.RuntimeException: Failed to load p2 repository with ID 'eclipse.kura' from location http://packagedrone.eclipse.org/p2/eclipse-kura-2.1
(...)
Caused by: java.lang.RuntimeException: Failed to load p2 repository with ID 'eclipse.kura' from location http://packagedrone.eclipse.org/p2/eclipse-kura-2.1
at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.loadMetadataRepository(TargetPlatformFactoryImpl.java:296)
(...)
Caused by: java.net.SocketTimeoutException: Read timed out
I've tried to set up a proxy with :
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
<configuration>
<argLine>-Dhttp.proxyHost=my-proxy-web -Dhttp.proxyPort=3128</argLine>
</configuration>
</plugin>
But it didn't work. The Kura project is using v0.20.0 of tycho-maven-plugin, I've tried to upgrade to 1.0.0 but it didn't work.
When I setup the same proxy in a browser, I can reach "http://packagedrone.eclipse.org/p2/eclipse-kura-2.1"
UPDATE :
I have also already defined my proxy in maven settings.xml, which works to find dependencies in various repositories, but which is not taken into account by Tycho maven plugin :
<proxies>
<proxy>
<id>main-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>my-proxy-web</host>
<port>3128</port>
<nonProxyHosts>*.mycomp.fr</nonProxyHosts>
</proxy>
</proxies>
UPDATE 2 :
maven debug logs when running with -X and -s settings.xml :
[DEBUG] Clearing proxy settings in OSGi runtime
(This is the only mention of "proxy" corresponding to the Tycho plugin source, no "Configuring proxy" and no "Ignoring proxy", it's like no "active" proxy has been found)
[INFO] Computing target platform for MavenProject: org.eclipse.kura:org.eclipse.kura.example.camel.aggregation:1.1.0 # /home/tristan/Dev/projects/IOT/kura.git/kura/examples/org.eclipse.kura.example.camel.aggregation/pom.xml
[DEBUG] Added p2 repository eclipse.kura (http://packagedrone.eclipse.org/p2/eclipse-kura-2.1)
[DEBUG] Using execution environment 'JavaSE-1.7' configured in Bundle-RequiredExecutionEnvironment
[DEBUG] Registered artifact repository org.eclipse.tycho.repository.registry.facade.RepositoryBlackboardKey(uri=file:/resolution-context-artifacts#/home/tristan/Dev/projects/IOT/kura.git/kura/examples/org.eclipse.kura.example.camel.aggregation)
[INFO] Adding repository http://packagedrone.eclipse.org/p2/eclipse-kura-2.1
[WARNING] Failed to access p2 repository http://packagedrone.eclipse.org/p2/eclipse-kura-2.1, use local cache.
org.eclipse.equinox.p2.core.ProvisionException: Unable to read repository at http://packagedrone.eclipse.org/p2/eclipse-kura-2.1/content.xml.
(...)
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to packagedrone.eclipse.org:80 timed out
UPDATE 3 :
My bad on "UPDATE 2", I've done so many tests with so many settings I used the wrong file for this test.
Here is the output with a proxy correctly setup (still failing) :
mvn clean install -X -s good-settings-with-proxy.xml
[DEBUG] Clearing proxy settings in OSGi runtime
[DEBUG] Configuring proxy for protocol http: host=10.91.31.45, port=3128
!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.106
!MESSAGE System property http.proxyHost is not set but should be 10.91.31.45.
!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.106
!MESSAGE System property http.proxyPort is not set but should be 3128.
And if I setup explicitly the system properties asked in the warning :
mvn clean install -X -Dhttp.proxyHost=10.91.31.45 -Dhttp.proxyPort=3128 -s /home/tristan/CODE/apache-maven-3.2.3/conf/settings.with-proxy.xml
!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.079
!MESSAGE System property http.proxyHost has been set to 10.91.31.45 by an external source. This value will be overwritten using the values from the preferences
!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.079
!MESSAGE System property http.proxyPort has been set to 3128 by an external source. This value will be overwritten using the values from the preferences
[DEBUG] Clearing proxy settings in OSGi runtime
[DEBUG] Configuring proxy for protocol http: host=10.91.31.45, port=3128, nonProxyHosts=*.edf.fr
!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.106
!MESSAGE System property http.proxyHost is not set but should be 10.91.31.45.
!ENTRY org.eclipse.core.net 1 0 2017-04-28 18:02:58.106
!MESSAGE System property http.proxyPort is not set but should be 3128.
Tycho derives its configuration from settings.xml, you will need to provide both http and https proxy elements with different IDs(in order to avoid getting overlapped in Tycho configuration file) in Maven's settings.xml.
<proxies>
<proxy>
<id>123</id>
<active>true</active>
<protocol>https</protocol>
<host>my-proxy-web</host>
<port>3128</port>
<nonProxyHosts>*.mycomp.fr</nonProxyHosts>
</proxy>
<proxy>
<id>321</id>
<active>true</active>
<protocol>http</protocol>
<host>my-proxy-web</host>
<port>3128</port>
<nonProxyHosts>*.mycomp.fr</nonProxyHosts>
</proxy>
</proxies>
khmarbaise is right, you should configure the proxy in maven's settings.xml
maven debug log (mvn clean install -X) should give you output from
https://github.com/eclipse/tycho/blob/f42e43c5722c0f74e55c5c03259476ac8b6f8836/tycho-core/src/main/java/org/eclipse/tycho/osgi/configuration/OSGiProxyConfigurator.java#L65
If it doesn't, your proxy settings are not taken into account for some reason
does maven actually use your settings.xml (try using -s )?
settings.xml format correct ( http://maven.apache.org/ref/3.5.0/maven-settings/settings.html )
For further debugging on the HTTP client level, use apache HTTP client tracing, see
https://wiki.eclipse.org/Equinox/p2/Reporting_Problems -> Reporting network connection issues
Another prerequisite to double-check is whether your build actually works without a proxy and with a clean local maven repo.
I want to create a Java Restful WebService with Maven template jersey-quickstart-webapp.
I'm facing the following error:
Could not resolve archetype org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.23.1 from any of the configured repositories.
Could not resolve artifact org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.23.1
Could not transfer artifact org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.23.1 from/to central (https://repo.maven.apache.org/maven2): connect timed out
Could not transfer artifact org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.23.1 from/to central (https://repo.maven.apache.org/maven2): connect timed out
I'm using Eclipse Luna, latest version.
You have to configure the proxy in your settings.xml
<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>
https://maven.apache.org/guides/mini/guide-proxies.html
If it still does not work, probably Maven Central is not accessible from within your network. Then you can only ask your admin to unblock it or to mirror it in a company repository.
I am using Maven 3.1.1. When I run mvn install I get the following error:
D:\spring source>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringDependencies 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
dependency-plugin/2.8/maven-dependency-plugin-2.8.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.648s
[INFO] Finished at: Mon Dec 16 15:01:47 IST 2013
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of it
s dependencies could not be resolved: Failed to read artifact descriptor for org
.apache.maven.plugins:maven-dependency-plugin:jar:2.8: Could not transfer artifa
ct org.apache.maven.plugins:maven-dependency-plugin:pom:2.8 from/to central (htt
p://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.mave
n.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException
My pom.xml is:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>spring-source-download</groupId>
<artifactId>SpringDependencies</artifactId>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>download-dependencies</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory> ${project.build.directory}/dependencies </outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Could not transfer artifact
org.apache.maven.plugins:maven-dependency-plugin:pom:2.8 from/to
central (http://repo.maven.apache.org/maven2): repo.maven.apache.org:
Unknown host repo.maven.apache.org
It seems like your maven cannot access remote central repository.
Check if you have an established internet connection.
Check if you can access default maven repo http://repo.maven.apache.org/maven2 in your browser.
Check if you have correct configuration in <repositories> and <proxies> in your your settings.xml
This error comes due to the proxy settings.
First of all, check whether you are able to connect to maven repository(http://repo1.maven.org/maven2) from browser.
Then update Maven proxy setting create/update a settings.xml in .m2 directory with following details:
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>{your proxy server host name}</host>
<port>{your proxy server port}</port>
<nonProxyHosts>maven</nonProxyHosts>
</proxy>
</proxies>
Solution given by Maven community: http://maven.apache.org/guides/mini/guide-proxies.html
This is caused by corrupted maven or plugins folder. To resolve this:
Delete \.m2\repository\org\apache\maven
mvn dependency:resolve -X
Where is my Settings.xml?
Windows users
It's in your C:/Users/<Username>/.m2/settings.xml
Also, this is for specific user.
Global one can be present at :
<Maven-Installation-Directory>/conf/settings.xml
But changing the User one might solve the issue if you can't find the global one.
Also, equally important, go to Preferences in Eclipse/STS:
Goto Maven -> User Settings
and verify if both global and user settings.xml files are mentioned in the properties, if not mention them by browsing.
1. Proxy Issue
Check Windows Proxy Setting.
If there is any proxy which your computer is using then you need to add proxy settings in your settings.xml file too.
Just add this chunk of code in your settings.xml
<proxies>
<proxy>
<id>proxy-id</id>
<active>true</active>
<protocol>http</protocol>
<host>ca-something.net</host>
<port>80</port>
<nonProxyHosts>localhost|10.140.240.90.*</nonProxyHosts>
</proxy>
</proxies>
2. Protocol Issue
Visit http://repo.maven.apache.org/: If it says Https required.
Then, you need to add this chunk of code to your settings.xml inside <mirrors>
<mirror>
<id>central-secure</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
Now it should be good to go.
3. None of the above works
Try disconnecting any company private VPN and try mvn clean build.
Disconnect from VPN and then run the command.
Probably a bit late to the party, but there appears to be an unknown host exception thrown out of maven even if the resource/dependency is unavailable at that address.
Which could mean that the problem may actually be that you have a transitive dependency that is pointing you to the wrong version of a jar (or one that is transitively included multiple times - one of which may be an unresolvable version). (I see it's looking for version 2.8 of the plugin but you specified version 3.1.1, so it's likely you have another dependency transitively including the wrong version).
You can exclude transitive inclusion of a dependency using the exclusions tag.
This issue was resolved for us by providing the correct proxy host in .m2/settings.xml.
Example:
<proxies>
<proxy>
<id>XXXXXXXXXX</id>
<active>true</active>
<protocol>http</protocol>
<host>na-xxxx-proxy.na.xxxxxxxxxx.net</host>
<port>80</port>
<nonProxyHosts>localhost|10.140.240.90.*</nonProxyHosts>
</proxy>
</proxies>
I am trying to build opennms in ubuntu.But when i give ./compile.pl(for compiling opennms source) in terminal, i get below error.
I am using maven 2.2.1 version.
Could anybody please provide a solution.
Note: removed the hyperlink like http in stacktrace..
[WARNING] Unable to get resource 'org.apache.felix:maven-bundle-plugin:pom:1.4.3' from repository java-net-repo (http://maven.opennms.org/content/groups/java.net-release): Authorization failed: Not authorized by proxy.
Downloading: //repo1.maven.org/maven2/org/apache/felix/maven-bundle-plugin/1.4.3/maven-bundle-plugin-1.4.3.pom
[WARNING] Unable to get resource 'org.apache.felix:maven-bundle-plugin:pom:1.4.3' from repository central (repo1.maven.org/maven2): Authorization failed: Not authorized by proxy.
Downloading: http://maven.opennms.org/content/groups/opennms.org-release/org/apache/felix/maven-bundle-plugin/1.4.3/maven-bundle-plugin-1.4.3.pom
[WARNING] Unable to get resource 'org.apache.felix:maven-bundle-plugin:pom:1.4.3' from repository opennms-repo (maven.opennms.org/content/groups/opennms.org-release): Authorization failed: Not authorized by proxy.
Downloading: repo1.maven.org/maven2/org/apache/felix/maven-bundle-plugin/1.4.3/maven-bundle-plugin-1.4.3.pom
[WARNING] Unable to get resource 'org.apache.felix:maven-bundle-plugin:pom:1.4.3' from repository central (//repo1.maven.org/maven2): Authorization failed: Not authorized by proxy.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Ensure you have proper username & password for the proxy authentication in your settings file.
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
</proxy>
</proxies>
http://maven.apache.org/guides/mini/guide-proxies.html
Raghu and Arun,
Thanks a lot. I was able to build with maven.What I did was, I removed maven and reinstalled with the same version as that of bundled with opennms, and also had not changed the settings.xml in maven(inside opennms).