Question

This is my first time asking for help in a public forum. So anyways Microsoft Windows has been my comfort zone as a development environment,recently I have been chucked into a linux environment at work, I seem to have got the hang of things, but when I tried to set up Maven2 I ran into some issues, I will get to the issue part later, but this is how I set up maven

Extracted maven to /usr/local/maven/apache-maven-2.2.1

Created a symbolic link to '/usr/bin' using following command

sudo ln -s /usr/local/maven/apache-maven-2.2.1 /usr/bin/mvn

when I mvn --version

Output :

Apache Maven 2.2.1 (r801777; 2009-08-07 00:46:01+0530) Java version: 1.7.0_25 Java home: /usr/local/java/jdk1.7.0_25/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version: "2.6.32-24-generic" arch: "i386" Family: "unix"

but when I try to do

mvn clean

Output :

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [clean]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: repo1.maven.org

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Was it helpful?

Solution

Maven is trying to download a plugin it needs to to do project cleanup from http://repo1.maven.org/. Do you need to use a proxy to connect to the internet? If so, see this guide: http://maven.apache.org/guides/mini/guide-proxies.html

If not, it might be that the network somewhere between your workstation and repo1.maven.org was having problems, which might be resolved now.

OTHER TIPS

The answer by Ireeder(Thanks man :-) ) did the trick.

My computer was behind a proxy, so I needed to do the following to allow maven access the Internet

Steps to solve it

  1. Open the M2_HOME/conf/settings.xml
  2. Look for this line block in the settings.xml

    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>{username}</username>
      <password> {password} </password>
      <host>{host}</host>
      <port>{port}</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    

  3. replace {value} with data relevant to you.

Enjoy!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top