Connection timing out while connecting to Maven repository - maven-2

I am trying to build my project in my local system using the below command
mvn clean install -Dmaven.test.skip=true
It fails with the below error. It is failing to connect to repo.maven.apache.org.
I pinged to the server repo.maven.apache.org, I can see the response back.
I am using maven 3 version and connecting to maven 2 repo (repo.maven.apache.org).
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building web-order-avpn 1702.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: **https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom**
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.778 s
[INFO] Finished at: 2017-01-19T21:21:10-06:00
[INFO] Final Memory: 6M/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/151.101.56.215] failed: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Would be great if some one can suggest on what is wrong with my system?

I had this same issue and just like the comments suggested it was the maven proxy. Setup in \conf\settings.xml
http://maven.apache.org/guides/mini/guide-proxies.html

Related

Maven - doesnt download from https://repo1.maven.org/maven2 but trying to download from http://repo1.maven.org/maven2

I m trying to run mvn site. I tried even running dependency tree. But still i m getting the following error on console. Ideally it should fetch from https and not from http. How do we get the maven from downloading from https and not from http ?
D:\Junit\junit5-examples-master\junit5-maven>mvn site
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.mkyong.core:junit5-maven >--------------------
[INFO] Building junit5-maven 1.0
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-report-plugin/3.0.0-M4/maven-surefire-r
eport-plugin-3.0.0-M4.pom
Downloading from org.source.repo: https://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-report-plugin/3.0.0-M4/maven-s
urefire-report-plugin-3.0.0-M4.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.063 s
[INFO] Finished at: 2020-01-20T17:14:59+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project junit5-maven: Could not resolve dependencies for project com.mkyong.core:junit5-maven:jar:1.0
: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-report-plugin:jar:3.0.0-M4: Failed to read artifact descrip
tor for org.apache.maven.plugins:maven-surefire-report-plugin:jar:3.0.0-M4: Could not transfer artifact org.apache.maven.plugins:maven-
surefire-report-plugin:pom:3.0.0-M4 from/to central (http://repo1.maven.org/maven2/): Failed to transfer file http://repo1.maven.org/ma
ven2/org/apache/maven/plugins/maven-surefire-report-plugin/3.0.0-M4/maven-surefire-report-plugin-3.0.0-M4.pom with status code 501 -> [
Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Pl assist.
Regards,

How to run javaee7 sdk samples?

My teacher want me to run javaee7 sdk sample "annotation-war". Then I download the javaee7 sdk from http://www.oracle.com/technetwork/java/javaee/downloads/index.html. But, I don't know how to run it.
I have tried the following steps:
First, I import code into Intelij IDEA, and run mvn cargo:run, but some error happen
"C:\Program Files\Java\jdk1.8.0_101\bin\java" -Dmaven.multiModuleProjectDirectory=C:\zjf\code\IDEA\javaee_samples\servlet\annotation-war -Dmaven.home=C:\zjf\soft\apache-maven-3.3.9 -Dclassworlds.conf=C:\zjf\soft\apache-maven-3.3.9\bin\m2.conf -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\zjf\soft\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.3 -s C:\zjf\soft\apache-maven-3.3.9\conf\settings.xml -Dmaven.repo.local=C:\zjf\soft\apache-maven-3.3.9\repo org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building annotation-war 4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- cargo-maven2-plugin:1.4.0:run (default-cli) # annotation-war ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.422 s
[INFO] Finished at: 2016-12-06T19:12:34+08:00
[INFO] Final Memory: 8M/184M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run (default-cli) on project annotation-war: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [glassfish4x], type = [installed]], configuration type [standalone]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it? -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Process finished with exit code 1
Then I think may be I have done the wrong thing, so I read the docs in "annotation-war". It's ok to run mvn clean and mvn verify. But when I run mvn cargo:run -Dglassfish.home=C:\zjf\soft\glassfish, I still encounter the same problem:
C:\zjf\code\IDEA\javaee_samples\servlet\annotation-war>mvn cargo:run -Dglassfish.home=C:\zjf\soft\glassfish
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building annotation-war 4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- cargo-maven2-plugin:1.4.0:run (default-cli) # annotation-war ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.038 s
[INFO] Finished at: 2016-12-06T20:59:57+08:00
[INFO] Final Memory: 8M/184M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run (default-cli) on project annotation-war: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:run failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [glassfish4x], type = [installed]], configuration type [standalone]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it? -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
I really don't know how to run javaee SDK samples. Can anyone who know how to run it give me some help?
The simplest way to get it running is to first build the project with mvn install which will output a WAR file. The bottom of the log will tell you the full, absolute path to the WAR file. the install Maven goal will also put copy it to your local repository which is managed by Maven, so you will see two different paths to the same WAR file. Either of these works, e.g:
/path/to/my/app/target/annotation-war-1.0.0-SNAPSHOT.war
You can then use the asadmin tool in GlassFish to deploy the WAR file, first making sure GlassFish is running:
C:\zjf\soft\glassfish\glassfish4\bin\asadmin start-domain
C:\zjf\soft\glassfish\glassfish4\bin\asadmin deploy /path/to/my/app/target/annotation-war-1.0.0-SNAPSHOT.war
This isn't the only way to get it running (there are many) but you may find this is the easiest to undestand, with the fewest things that might go wrong, despite it being a bit long-winded.

Getting start with Maven

I am very new to Maven.I have installed the maven on my local machine.
After installation for trial basis i was trying to execute mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app
for that i am getting below error message.
C:\work\maven2.2\bin>mvn archetype:generate -DarchetypeGroupId=org.apache
.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retri
eved from repository: central due to an error: Error transferring file: repo1.ma
ven.org
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exi
st or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Aug 30 11:45:49 IST 2011
[INFO] Final Memory: 1M/59M
[INFO] ------------------------------------------------------------------------
Can any one help me if i need to have a prerequisite setting for the same?
Thanks in advance. :)
It's comand is correct and on my computer run correctly. But you have Error transferring file. So on this branch you may read about this error.
EDIT:
Tutorials:
First of all read this article : maven in 5 minutes
For more information : Maven Getting Started Guide
The second article will give you all you need to understend maven.

Simple Wicket / Maven quickstart problem

Wicket gives a simple "quickstart" command generator for use with Maven on their homepage at http://wicket.apache.org/start/quickstart.html
I installed this and understand that Maven automatically downloads requisites that it needs from its central repository. But when I run the command it generates, I get:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.161s
[INFO] Finished at: Fri May 06 22:07:28 EDT 2011
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\xxxxxx\Projects\[project dir]). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
What am I doing wrong?
the message suggests that Maven didn'recognize archetype plugin.
Can you copy and paste exact command that you are using?
Are using Windows cmd shell?
Try escaping arguments.

Maven2 problem to access plugins repository !

i just come to install maven2, after configuring the settings.xml in ${user.home}/.m2 and fixing a proxy error. Now by executing the command :
mvn -U archetype:create -DgroupId=maven-test -DartifactId=maven-test
-DpackageName=net.ensode.maventest
i get this error :
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retri
eved from repository: central due to an error: Authorization failed: Access deni
ed to: http://repo2.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exi
st or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Apr 29 16:05:40 CEST 2010
[INFO] Final Memory: 2M/247M
[INFO] ------------------------------------------------------------------------
any idea of what could cause it ?
thanks !
I think that the most likely cause is that your proxy requires you to authenticate, and you haven't configured the authentication details into your settings.xml file.