user979959
user979959

Reputation:

Cannot resolve dependencies with maven

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?

Upvotes: 0

Views: 17713

Answers (5)

nitin angadi
nitin angadi

Reputation: 506

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>

Upvotes: 1

hmehandi
hmehandi

Reputation: 366

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...

Upvotes: 0

jambriz
jambriz

Reputation: 1303

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

Upvotes: 0

Ryan Stewart
Ryan Stewart

Reputation: 128899

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.

Upvotes: 2

tolitius
tolitius

Reputation: 22549

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

Upvotes: 2

Related Questions