tags:

views:

89

answers:

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.

A: 

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

Michael Bazos
How to resolve it. I want to use to Local Repo instead of Maven Repo.How to solve it?
+1  A: 

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.

Pascal Thivent
Even if i give -o option it results with same Error. Can you please help me Pascal
@gnash-85: I don't know what I can do for you. Running Maven without an Internet connection, or a corporate repository, or a pre-populated local repository (with all the limitation this implies) is not possible. What are your constraints exactly?
Pascal Thivent
See I want to convert all ant scripts to Maven one. This is the task i was given. But Now I want to test maven whether it is working or not. But it fails initially only. So Pascal Sir, can you please help me.
@gnash-85: Ok, I get that. But did you read my comment? I gave you 3 possibilities to make things work. If none of them are an option, then I'm afraid you won't be able to use Maven. I don't have any magical solution, sorry.
Pascal Thivent
Yes Pascal Sir. Now i have set-up some proxy settings and now it is working. Can you please how to convert from ant to maven?