0

I can't seem to do anything with maven because it can't download its dependencies. When I try to run a sample application from http://openejb.apache.org/ejb3-tutorial.html it gives me some errors:

D:\apache-maven-3.0.3\openejbsamples\simple-stateless>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OpenEJB :: Examples :: Simple Stateless Pojo 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.454s
[INFO] Finished at: Thu Oct 13 11:47:26 CST 2011
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.ap
ache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo1
.maven.org/maven2): Error transferring file: repo1.maven.org: Unknown host repo1.maven.org -> [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

Why can't I download the repositories?

UPDATE: never mind. My boss told me I can't do it because of proxy setting of the company. Anyway, I just want to study ejb the fastest way without using maven if possible?

tshepang
  • 12,111
  • 21
  • 91
  • 136

5 Answers5

2

Take a look at Using Proxies With Maven, as the issue is most likely caused by you having an "exotic" Internet connection. (firewall, dns overwrite, other proxies, etc..)

If you are indeed behind the proxy, and it requires username/password, check out cntlm

tolitius
  • 22,149
  • 6
  • 70
  • 81
  • hey, thanks for the quick response. yes we do have an exotic connection here and my boss seems to say that is impossible to go around because we got some strict policies here and the network administrators won't help either. i guess i will just do it at home. –  Oct 13 '11 at 04:13
  • but if you do have a proxy server that you connect through, then you just need the `url`, `port`, and possibly `username`, `password`. These settings should be found somewhere on your system, since you are able to post this questions to stackoverflow :) Check your browser for proxy settings, you would probably find what you need there. – tolitius Oct 13 '11 at 04:16
2

It looks like you have a host name lookup problem: Unknown host repo1.maven.org. That's the correct host name for the central Maven repository. Check your DNS settings and/or any local host name overrides you might have. Of course, if you're using a corporate DNS and your internet access is generally restricted, that's probably it.

Ryan Stewart
  • 126,015
  • 21
  • 180
  • 199
  • hello ryan. thanks for the quick response. i have that link on my pom file within the repository tag. that is correct right? –  Oct 13 '11 at 04:15
1

Adding following in settings.xml worked for me

<profiles>
    <profile>
            <id>outsideMyWorld</id>
            <repositories>
        <repository>
                <id>central</id>
                <url>http://repo1.maven.org/maven2</url>
                <snapshots>
            <enabled>false</enabled>
                </snapshots>
                <releases>
            <enabled>true</enabled>
                </releases>
        </repository>
            </repositories>
    </profile>
</profiles>

<activeProfiles>
        <activeProfile>outsideMyWorld</activeProfile>
</activeProfiles>
nitin angadi
  • 382
  • 5
  • 10
0

I also struggled for weeks to fix this.... This is how I fixed...

In your settings.xml (under Maven_HOME\conf directory)

I added proxy entry as below

<proxies>
    <proxy>
        <active>true</active>
        <protocol>http</protocol>
        <host>IPAddressOfYourGateway</host>
        <port>8080</port>
        <username>YourNetworkUserName</username>
        <password>YourNetworkPassword</password>
        <nonProxyHosts>LocalIPAddress1|LocalIPAddress2|LocalIPAddress3</nonProxyHosts>
     </proxy>
 </proxies>

wherein,

1) "IPAddressOfYourGateway" can be obtained from IEExplorer -> Settings-> Proxy.. this is IP Address of your Proxy..

2) LocalIPAddress1|LocalIPAddress2.. "|" .. the pipe sign is used for adding multiple IP Addresses... that need to be bypassed from proxy... You need to check with your network team for the port in case it doesn't work as it is in your case...

Ajeet Ganga
  • 8,353
  • 10
  • 56
  • 79
hmehandi
  • 356
  • 4
  • 11
0

If you are not allowed to have the proxy configuration (security issues), maybe you can convince your boss and the network admin to set up a local maven repository in some dev server. Check out this link (if your proxy and your network admin are ok with it .. of course :P) http://www.theserverside.com/news/1364121/Setting-Up-a-Maven-Repository

jambriz
  • 1,273
  • 1
  • 10
  • 25