38

I have install maven in my machine. I have properly set the class-path and maven home folder. Every time I execute mvn clean install, it gives me exception. I have also tried to delete the .m2 folder but the same result.

  • mvn -version output

    Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
    Maven home: C:\maven-3
    Java version: 1.7.0_45, vendor: Oracle Corporation
    Java home: D:\jdk170_45\jre
    Default locale: en_US, platform encoding: MS950
    OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
    
  • log for mvn -X clean install

        Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
        Maven home: C:\maven-3
        Java version: 1.7.0_45, vendor: Oracle Corporation
        Java home: D:\jdk170_45\jre
        Default locale: en_US, platform encoding: MS950
        OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
        [DEBUG] Created new class realm maven.api
        [DEBUG] Importing foreign packages into class realm maven.api
        [DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
        [DEBUG]   Imported: javax.enterprise.util.* < plexus.core
        [DEBUG]   Imported: javax.inject.* < plexus.core
        [DEBUG]   Imported: org.apache.maven.* < plexus.core
        [DEBUG]   Imported: org.apache.maven.artifact < plexus.core
        [DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
        [DEBUG]   Imported: org.apache.maven.cli < plexus.core
        [DEBUG]   Imported: org.apache.maven.configuration < plexus.core
        [DEBUG]   Imported: org.apache.maven.exception < plexus.core
        [DEBUG]   Imported: org.apache.maven.execution < plexus.core
        [DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core
        [DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
        [DEBUG]   Imported: org.apache.maven.model < plexus.core
        [DEBUG]   Imported: org.apache.maven.monitor < plexus.core
        [DEBUG]   Imported: org.apache.maven.plugin < plexus.core
        [DEBUG]   Imported: org.apache.maven.profiles < plexus.core
        [DEBUG]   Imported: org.apache.maven.project < plexus.core
        [DEBUG]   Imported: org.apache.maven.reporting < plexus.core
        [DEBUG]   Imported: org.apache.maven.repository < plexus.core
        [DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
        [DEBUG]   Imported: org.apache.maven.settings < plexus.core
        [DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
        [DEBUG]   Imported: org.apache.maven.usability < plexus.core
        [DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
        [DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
        [DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
        [DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
        [DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
        [DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
        [DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
        [DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
        [DEBUG]   Imported: org.codehaus.classworlds < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
        [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.* < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.collection < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.graph < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.impl < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.installation < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.repository < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.spi < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core
        [DEBUG]   Imported: org.eclipse.aether.version < plexus.core
        [DEBUG]   Imported: org.slf4j.* < plexus.core
        [DEBUG]   Imported: org.slf4j.spi.* < plexus.core
        [DEBUG] Populating class realm maven.api
        [INFO] Error stacktraces are turned on.
        [DEBUG] Reading global settings from C:\maven-3\conf\settings.xml
        [DEBUG] Reading user settings from C:\Users\H1514\.m2\settings.xml
        [DEBUG] Reading global toolchains from C:\maven-3\conf\toolchains.xml
        [DEBUG] Reading user toolchains from C:\Users\H1514\.m2\toolchains.xml
        [DEBUG] Using local repository at C:\Users\H1514\.m2\repository
        [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\H1514\.m2\repository
        [INFO] Scanning for projects...
        [DEBUG] Extension realms for project camel:camel:jar:0.0.1-SNAPSHOT: (none)
        [DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
        [DEBUG] === REACTOR BUILD PLAN ================================================
        [DEBUG] Project: camel:camel:jar:0.0.1-SNAPSHOT
        [DEBUG] Tasks:   [clean, install]
        [DEBUG] Style:   Regular
        [DEBUG] =======================================================================
        [INFO]                                                                         
        [INFO] ------------------------------------------------------------------------
        [INFO] Building camel 0.0.1-SNAPSHOT
        [INFO] ------------------------------------------------------------------------
        [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
        [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
        [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
        [DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
        [DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
        [DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
        [DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repo.maven.apache.org/maven2
        [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2
        Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
    
        [DEBUG] Writing tracking file C:\Users\H1514\.m2\repository\org\apache\maven\plugins\maven-clean-plugin\2.5\maven-clean-plugin-2.5.pom.lastUpdated
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 22.858 s
        [INFO] Finished at: 2015-05-29T14:11:00+08:00
        [INFO] Final Memory: 5M/15M
        [INFO] ------------------------------------------------------------------------
        [ERROR] 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: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect -> [Help 1]
        org.apache.maven.plugin.PluginResolutionException: 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
            at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:117)
            at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:179)
            at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:298)
            at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:241)
            at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:169)
            at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:155)
            at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:131)
            at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:145)
            at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:96)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:109)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
            at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
        Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
            at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302)
            at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:218)
            at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287)
            at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)
            ... 26 more
        Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
            at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287)
            ... 29 more
        Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect
            at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
            at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
            at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
            ... 32 more
        Caused by: org.apache.maven.wagon.TransferFailedException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect
            at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1066)
            at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:960)
            at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
            at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
            at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
            at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:560)
            at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427)
            at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:404)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447)
            at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
            ... 37 more
        Caused by: org.apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnectException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection timed out: connect
            at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:140)
            at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
            at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
            at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
            at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
            at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:86)
            at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
            at org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
            at org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
            at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:832)
            at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:983)
            ... 46 more
        Caused by: java.net.ConnectException: Connection timed out: connect
            at java.net.DualStackPlainSocketImpl.connect0(Native Method)
            at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:579)
            at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:239)
            at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
            ... 56 more
        [ERROR] 
        [ERROR] 
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
    
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Kartik Jajal
  • 732
  • 4
  • 10
  • 16

24 Answers24

50

Your debug output indicates that Clean is the first thing that it's trying to run, so I'm guessing it's failing to download any plugins from central.

First off, see if you can download the plugin jar directly in a web browser: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar

If that works then your web browser has connectivity to central but maven doesn't. That suggests to me that your web browser is using a proxy that maven isn't configured to use.

Maven proxy settings are described in depth here. To simplify that a little fill this out (replace the protocol/host/port with the values from your internet settings) and put it in the <settings> tag of your maven settings.xml file:

<proxies>
  <proxy>
    <id>proxy</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>proxy.example.com</host>
    <port>8080</port>
  </proxy>
</proxies>
1337joe
  • 2,327
  • 1
  • 20
  • 25
  • This doesn't work for me. The reason being the above proxy didn't have username, password. Therefore, I tried below mentioned proxy in settings.xml & it worked. true http proxy.somewhere.com 8080 proxyuser proxypassword www.google.com|*.somewhere.com – Harleen Mar 18 '16 at 04:51
  • 10
    My browser is not using any proxy still I am able to download the plugin jar directly from the browser, but maven is giving the error as described in the question. What else could be the problem? – Anna Shekhawat Apr 07 '17 at 06:53
  • 3
    @AnnaShekhawat did you find any solution for this? I'm having the same issue – SebastienPattyn Jun 04 '18 at 08:52
  • @AnnaShekhawat did you find a solution? – Vin Shahrdar Oct 01 '18 at 14:56
  • In my case, I had proxy in settings.xml file and I had to remove it to make it work. Thanks for the answer!!! – Jasser Dec 31 '18 at 16:20
  • Your solution save my day :) – Mankeomorakort Apr 13 '20 at 09:25
27

The error is due to maven official repository being not accessible. This repo (https://repo.maven.apache.org/maven2/) is not accessible so follow these steps:

  1. Firstly delete your /home/user/.m2 folder
  2. create .m2 folder at user home and repository folder within .m2
  3. copy the default settings.xml to .m2 folder
  4. Change mirrors as follows in the settings.xml as shown in below snap mirror_settings

<mirrors>
  <mirror>
    <id>UK</id>
    <name>UK Central</name>
    <url>http://uk.maven.org/maven2</url>
    <mirrorOf>central</mirrorOf>
  </mirror>
</mirrors>
  1. Execute the mvn clean commands now .....
8

In my case my problem was that I was using an older version of NetBeans. The Maven repository removed an http reference, but the embedded Maven in Netbeans had that http reference hard-coded. I was really confused at first because my pom.xml referenced the proper https://repo.maven.apache.org/maven2.

Fixing it was pretty simple. I downloaded the latest zip archive of Maven from the following location and extracted it to my machine: https://maven.apache.org/download.cgi

Within Netbeans at Tools -> Options -> Java -> Maven on the "Execution" section I set "Maven Home" to the newly extracted zip file location.

Now I could build my project....

Doug
  • 6,446
  • 9
  • 74
  • 107
  • 1
    This was the case for me. The `mvn package` command works from the console, but build from NetBeans fails, which indeed points to a faulty IDE configuration. – antanta Oct 08 '20 at 07:27
  • 1
    Thanks to you I can go one step forward. – Park JongBum Apr 10 '21 at 13:05
  • 1
    Thank you so much! If you use netbeans 8.2 with jdk 1.8, then you might need to also see https://stackoverflow.com/questions/58411279/java-with-maven-wouldnt-build-cannot-run-program-cmd-malformed-argument-has – tobi delbruck Jun 12 '23 at 08:47
3

It might be that you are forgetting to specify the settings which was the case with me.

Try:

mvn clean install -s settings_file.xml

Neev
  • 31
  • 3
2

I faced the same problem but it resolved with some changes in setting.xml(.*\apache-maven-3.3.3\apache-maven-3.3.3\conf).

  <proxies>
  <proxy>
    <id>proxy</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>HOSTNAME</host>
    <port>PORT</port>
  </proxy>
</proxies>

Just check the hostname and port from the IE setting -> connections -> LAN Setting -> Proxy server

Hope this will resolve your problem also :)

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
Md Rahman
  • 31
  • 1
2

I faced the same problem, even if I was working on my home wifi connection, without any proxy requirements.

My project was created at c:\users\<>\Workspace\Project\

When I went to above location and ran

mvn clean install

I got below error:

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its de
endencies could not be resolved: Failed to read artifact descriptor for org.apa
he.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.ap
che.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.mave
.apache.org/maven2)

It took me entire day to try ways and means to crack this, but the solution in my case, was damn simple.

I moved my project to non-user specific location, at E:\Workspace\Project\

This has done wonders for me!

Nirav Khandhedia
  • 191
  • 1
  • 4
  • 17
2

I resolved this issue by switching to the oracle jdk from open jdk 8.

$ java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
FortyTwo
  • 2,414
  • 3
  • 22
  • 33
Duncan
  • 176
  • 1
  • 4
2

This is what worked for me in IntelliJIdea:

Go to File -> Build, Execution, Deployment -> Build Tools -> Maven -> Repositories

Check that there are two repositories:

https://repo.maven.apache.org/maven2  (Remote)
C:/Users/_user_/.m2/repository   (Local)

And then click on Update for both repos. The update of remote repository will take a while, but in the end click on OK and that's all.

0

I faced the same problem and was frustrated to see as to all options i tried and none of them work,

Turns out once you have configured everything correctly including settings.xml

just clear your local repository folder and try mvn commands. That greatly helped me

Hope this helps others

Dave
  • 31
  • 3
0

I faced a similar issue. Try to follow the below steps: Manually delete the .m2 folder. Refer to the settings.xml file and check if the repository details are proper, like id and url tags. Also make sure you are connected to same network and check if the URL is accessible from browser. And lastly keep maven projects in /home/User/.

0

refering to Deepak Vishwakarma's answer, I tried with that and was facing same problem with the url-problem. I installed maven-3.6.3 and inside .m2 folder I found a

settings.xml.bak

file and from that copied that mirror link and just changed url what @Deepak did. It worked like charm! Mirror link I got from that .bak file

http://local.maven.repo:9081/nexus/content/groups/public

Then executed :

mvn clean 
mvn clean install
user404
  • 1,934
  • 1
  • 16
  • 32
0

I have faced the same issue. I have changed the maven-assembly-plugin to 3.1.1 from 2.5.3 in POM.xml

Proposed version should be done under plugin section. enter code here artifact Id for maven-assembly-plugin

Michael Kemmerzell
  • 4,802
  • 4
  • 27
  • 43
0

Just deleting repository folder in .m2 folder resolved the same issue.

0

Think to change JDK used in your project. For me I changed JDK from 1.6 to 1.8 and I updated maven.

Rainer Glüge
  • 1,851
  • 1
  • 15
  • 15
Amine ABBAOUI
  • 175
  • 1
  • 12
0

For all the Windows users, try moving your codebase to a shorter windows path for eg: C:/myProj

Deeply nested Maven jar files can create a longer file path in windows. Since windows OS, by default, limits the file path length to 260 characters, it throws exception when trying to read a file located at a path that becomes more than 260 characters.

You can change this default to increase this limit to more than 260 chracters. Search around the web and you will find many posts on how to do that.

You can face similar problem while using npm packages also.

MNayal
  • 3
  • 3
0

I faced the same issue but, in my case, I had only to point my project to a JDK instead of the JRE in the build path then it solved the issue and I was able to import all maven dependencies with no problem!

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
luba
  • 1
0

None of the other answers worked for me. The solution that worked for me was to download the missing artifact manually via cmd:

mvn dependency:get -DrepoUrl=http://repo.maven.apache.org/maven2/ -Dartifact=ro.isdc.wro4j:wro4j-maven-plugin:1.8.0

0

After creating the sample app from spring initializr, I got the same type of error Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:2.5.2 after running the application from my IntellijIdea.

In my project directory I opened the folder mvnw from intellijIdea It was displaying the option for install on top of this file I clicked on install After successful installation, I ran the spring application once again, It ran without giving any error.

u_pendra
  • 908
  • 1
  • 10
  • 25
0
  1. Locate settings.xml under conf folder in Maven folder.
  2. Locate proxies tag, add the following.
<proxies>
  <proxy>
    <id>proxy</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>your company host</host>
    <port>your company port</port>
  </proxy>
</proxies>
Pratik Gaurav
  • 661
  • 7
  • 8
0

I had this issue while installing NetBeans 8.2 on Ubuntu 18.04. If you are using NetBeans on Ubuntu and you are facing "maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved".

This is because, you have newly installed Ubuntu and/or NetBeans and building project first time by doing right-click and selecting an option as clean and build. Don't build the project in this way.

Open the terminal (IDE terminal), go to your project directory and type the following command:

mvn clean install.

This will automatically download and install all required things and build your project correctly. You may also required to install the mvn by:

sudo apt install maven
UdayanBKamble
  • 99
  • 1
  • 7
0

In My Case it is unable to download the required jar from the repo When i checked the url("http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.5.2/maven-install-plugin-2.5.2.pom") identified that url request goes to http:// but the repo access by "https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.5.2/maven-install-plugin-2.5.2.pom" So i go to >preferences>maven>installation select the embedded maven or else you can download latest maven and configure in eclipse.

0

Write to terminal

mvn -v

I bet the Java-version is not what you thought you were using.

In my case it should have been openjdk17 but i had changed my enviroment variable JAVA_HOME to different (jre7) when i was doing other work. So it got mixed up.

tl;dr Check your JAVA_HOME enviroment variable.

Kajisensi
  • 43
  • 6
0

I had to use offline mode, so none of responses worked. In my case helped running maven with -llr option. It enables Legacy Local Repository behaviour.

Real reason of the problem is still unkonwn.

DKSD
  • 33
  • 2
  • 6
-1

The problem is probably that the JVM client doesn't trust the repo.maven.apache.org certificate. As suggested, you can try and access https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom in your browser.

If that works - this is probably the case. You will have to explicitly tell the JMV to trust maven certificate. You can refer to the answer here "PKIX path building failed" and "unable to find valid certification path to requested target"

for me on Mac OS, the certificate file is located at /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/security and the certificate you need is the one presented to your browser when you enter the URL mentioned above

Ofrik
  • 1
  • 1