File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes How to work with maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to work with maven" Watch "How to work with maven" New topic
Author

How to work with maven

yatin shinde
Greenhorn

Joined: Jan 10, 2008
Posts: 6
hi,
I am just started to learn maven. i download binaries and install properly.
Now using maven documentation i am tring to create 1st maven project
AS mention in document i type foll. command on command prompt
mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app

but Nothing happel It gives me foll. ERROR
maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] artifact org.apache.maven.plugins:maven-archetype-plugin: checking for up
dates from central
[WARNING] repository metadata for: 'artifact org.apache.maven.plugins:maven-arch
etype-plugin' could not be retrieved from repository: central due to an error: E
rror transferring file
[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: 15 seconds
[INFO] Finished at: Wed Mar 12 14:23:36 GMT+05:30 2008
[INFO] Final Memory: 1M/254M
[INFO] ------------------------------------------------------------------------

I am search on net it tell me that i am working across firewall that why i'll get that ERROR i am tyring to configure proxi in setting.xml butstll it not work

Anybody know how to solve this problem. Please help me......:-(
Srikanth Nittala
Greenhorn

Joined: Sep 24, 2006
Posts: 22
It appears that Maven is unable to bring the required files/jars from its remote repository which is obviously on the internet. I am almost positive that you have a firewall thats blocking this file transfer. So go to the ${User.home}/.m2 directory and create a settings.xml file with the following entry in it: You will have to fill in the appropriate values for your proxy settings.

<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.mycompany.com</host>
<port>8080</port>
<username>your-username</username>
<password>your-password</password>
</proxy>
</proxies>
</settings>
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9426
    
    2

Why is that we need to connect to repositories when using Maven?

This looks like a limitation that we need an internet connection to use Maven. Does'nt it?
[ May 05, 2008: Message edited by: Jothi Shankar Kumar Sankararaj ]

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16136
    
  21

You don't HAVE to be connected to the Internet, but it seriously helps.

One of Maven's major selling points is that it's designed for very large projects that are being worked on concurrently by a lot of people who may or may not be closely working with each other and who want to avoid re-inventing existing Java functions.

As sort of a side-effect, you can transfer a Maven project from one user to another using a fairly small amount of data and the proper build environment will then automatically be filled in when the next user runs Maven. As an example, I just emailed a 125K ZIP file to someone last night. When a Maven build is run against it, the final results are over 30MB and the program should have completely built itself without any user modifications or manual setup.

Maven is designed with the idea that much of the value of a project comes from libraries such as the Spring Framework jars. These libraries can come from a multititude of locations, and appear in multiple versions, but by establishing Maven Repositories, the task of keeping them all co-ordinated is simplified. There's only one place to go to find them all and there's only a limited number of fixed releases, so you don't have to worry about stealth changes to critical external functions interfering with your work.

However, they do realize that it's not always convenient to hit the Internet for everything. One way to reduce traffic is to set up a Maven Repository mirror. The mirror can be differentially maintained using rsync. Another thing that reduces traffic is that maven will automatically set up a local cache of items your projects are using so they only have to be downloaded once to your machine (or network share).

If you already have everything you need, you can speed up the build process slightly by running Maven with the "-o" (offline) switch. It doesn't make a major difference, but when you are sure you won't be needing to downloading any more packages, it's a slight improvement.


Customer surveys are for companies who didn't pay proper attention to begin with.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9426
    
    2

Good information. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to work with maven