I am unable to run maven2 - maven-2

I am not able to run Maven 2.1. I get following Error while running:
****************************************************************
naresh#HYRDSRVIHUB01:~/.m2> mvn archetype:create -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 retrieved from repository: central due to an error: Error transferring file: Connection refused
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist 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 Jul 22 17:59:02 IST 2010
[INFO] Final Memory: 3M/240M
[INFO] ------------------------------------------------------------------------
******************************************************************
Help me to get rid of it.

As already pointed out, you are running Maven. However, depending on what you're asking Maven to do, Maven might have to download libraries from a remote repository: plugins, dependencies, etc that are then stored in your local repository and downloading libraries from a remote repository requires a connection.
If you start using Maven with an empty local repository, this is something you can't avoid and you'll have to let Maven download what it needs first.
Sure, you can run Maven offline (using the -o or --offline command line optionsbut this will work only if you already have the required stuff in your local repository.
Oh, and by the way, I'm not sure it's really wise to create a project under your ~/.m2 directory. You should run archetype:create from another location, e.g. ~/Projects.

Your running maven, the issue is either with your connection it seems to be getting rejected by the maven repo:
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: Connection refused

Related

cms.war - No such file or Directory

I try to install a test version of hippocms. I stuck in
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45:21 min
[INFO] Finished at: 2017-02-16T15:18:32+01:00
[INFO] Final Memory: 16M/200M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:start (cargo-run) on project gogreen: Execution cargo-run of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:start failed: Failed to create deployable with implementation class org.codehaus.cargo.container.tomcat.TomcatWAR for the parameters (container [id = [tomcat8x]], deployable type [war]). InvocationTargetException: Failed to parse Tomcat WAR file in [/courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war]: Failed to find file [/courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war]: /courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war (No such file or directory) -> [Help 1]
Any idea?
Today I repeat mvn clean install -X and it worked fine.
For every other guy who came here by search: The -Pcargo.run uses tomcat and the built-in tomcat-users.xml so the only valid account is admin and password admin like tomcat does.
Have you tried a clean install before running cargo?
mvn clean install && mvn -Pcargo.run
edit:
The more modern way of doing it would be:
mvn clean verify
and then do your cargo.run.
see also Build Project

Connection timing out while connecting to Maven repository

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

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.

What could be causing 'error transferring file' in maven?

I have installed maven 2.2.1 on my debian machine and getting the following error
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: repository.exoplatform.org
What I have been able to find relating to this problem is its typically caused by not having proxy settings correctly configured or a firewall blocking traffic, but I dont have either on this machine. Also, I have the same settings file on my windows machine and it works fine.
Any suggestions would be greatly appreciated as I am stumped.
exo#melb-web:~/test$ mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-07 05:16:01+1000)
Java version: 1.5.0_22
Java home: /usr/local/bin/jdk1.5.0_22/jre
Default locale: en_AU, platform encoding: UTF-8
OS name: "linux" version: "2.6.22-3-amd64" arch: "i386" Family: "unix"
exo#melb-web:~/test$ mvn archetype:generate
[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 retrieved from repository: central due to an error: Error transferring file: repository.exoplatform.org
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist 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: Wed Jun 30 10:18:33 EST 2010
[INFO] Final Memory: 2M/136M
[INFO] ------------------------------------------------------------------------
* EDIT *
I tried removing the settings.xml and generating a new maven project. I got the following
exo#melb-web:~/test$ mvn archetype:generate
[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 retrieved from repository: central due to an error: Error transferring file: repo1.maven.org
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist 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: Wed Jun 30 11:40:26 EST 2010
[INFO] Final Memory: 1M/136M
[INFO] ------------------------------------------------------------------------
I think this rules out it being a problem with the settings.xml or a pom. Is there a way to get more information about why maven cant connect to the repository?
I've tried the same commands and get the same error message, so I've run using the debug flag. This gives a different root exception depending on the proxy settings etc.
Try running the same in case you get better verbose output.
mvn -X archetype:generate
Case 1:
Machine not connected to network (Cable disabled) gives a debug message
[DEBUG] Exception
org.apache.maven.wagon.TransferFailedException: Error transferring file
...
Caused by: java.net.UnknownHostException: repo1.maven.org
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
[INFO] Repository 'central' will be blacklisted
Case 2:
Machine connected with incorrect proxy gives the debug message
[DEBUG] Exception
org.apache.maven.wagon.TransferFailedException: Error transferring file
...
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
[INFO] Repository 'central' will be blacklisted
Here error could be 403, connection reset or Authorization or access forbidden error
Case 3:
Machine with direct connection to internet
[DEBUG] Trying repository central
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archet
ype-plugin/2.0-alpha-5/maven-archetype-plugin-2.0-alpha-5.jar
[DEBUG] Artifact resolved
[INFO] ------------------------------------------------------------------------
and so on till it works.
Just to close the loop on this one - it turned out to be an issue with the libraries debian had available for java uses to resolve hostnames. The fix is to apply a new libdns for java as described here http://www.ehow.com/how_4747553_fix-unknownhostexception-java-applications-ubuntu.html. Once I did this I am able to run mvn with jdk5 and jdk6.
I would guess it has something to do with the repository settings in the pom, a parent pom or in your ~/.m2/settings.xml file. Its also possible that the repo at exoplatform is misconfigured.
With no repositories set the archetype plugin would come from repo1.maven.org
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/
I had the same problem. In my case it was actually a leftover settings.xml file from a prior job. I backed up and removed ~/.m2/settings.xml and the build went through just fine.
Update to maven 3.0.4 or up, if possible.
I've studied the maven source code: There is a bootstrap problem inside maven 2.2.1. The proxy is looked up as HTTPS when accessing HTTPS servers, but you only can have one proxy as active. There is no fallback to HTTP proxy. In maven 3.0.4 this issue seems to be solved.
The quick "solution" is to give fully qualified plugin name in the command :
mvn org.mortbay.jetty:maven-jetty-plugin:run
Don't forget to turn off your VPN especially for Chinese people. It's an SSL handshake issue.