views:

117

answers:

4

I have a dependency on Hibernate 3.5.3 which is only available to me from the new JBoss Maven repository is hosted on Sonatype's Nexus and all the URLs are secured with HTTPS.

I can access this repository from behind my corporate firewall via the web browser. But Maven is unable to resolve the artifacts.

I see the following warning at the start of the build:

[WARNING] Unable to get resource 'org.hibernate:hibernate-core:pom:3.5.3-Final' from repository jboss.org (https://repository.jboss.org/nexus/content/repositories/releases): Error transferring file: repository.jboss.org

I expected that adding the following the the section of the global settings.xml should have done the trick for me:

<proxy>
    <id>http.proxy</id>
    <active>true</active>
    <protocol>http</protocol>
    <username>me</username>
    <password>private</password>
    <host>proxy.somecompany.com</password>
    <port>80</port>
    <nonProxyHosts>*.somecompany.com</nonProxyHosts>
 </proxy>
<proxy>
    <id>https.proxy</id>
    <active>true</active>
    <protocol>https</protocol>
    <username>me</username>
    <password>private</password>
    <host>proxy.somecompany.com</password>
    <port>80</port> <!-- tried 443 too -->
    <nonProxyHosts>*.somecompany.com</nonProxyHosts>
 </proxy>

But it it doesn't work for me.

In my pom.xml I have the following repository dependency declared:

 <repository>
     <id>jboss.org</id>
     <name>JBoss Repository</name>
     <url>https://repository.jboss.org/nexus/content/repositories/releases&lt;/url&gt;
 </repository>

I am constrained to using Maven 2.0.8 but I have checked and it doesn't work on Maven 2.2.1 either.

A: 

Hey Mathews, I was just trying to hit the Jboss repository URL that you had posted here using a browser and it threw me a blank page. A bit of googling for the jboss repository gave me this url.

http://repository.jboss.org/maven2/

I guess this should solve your problem. Its just a matter of wrong repository URL.

To add further, the repository has hibernate core version 3.5.1 and not 3.5.3 .Guess this should not be a problem for you.

Manoj
The repository URL is not wrong, [JBoss is now using Nexus](http://relation.to/Bloggers/JBossMavenRepositoryChanges), Hibernate 3.5.3 is not available in the "old" repository.
Pascal Thivent
@Manoj JBoss have deprecated that old repository URL and will not be posting releases to the old repository. I am relying very heavily on JBoss components on my current project so Hibernate is just one instance of the problem.
bmatthews68
A: 

Maybe this is not a correct anwser but i found that when you use only one proxy maven can dowload the artifacts .

So for connection the https site try this , and all the https dependencies should dowload.

<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd"&gt;
<proxies> 
   <proxy>
      <active>true</active>
      <protocol>https</protocol>
      <host>proxy.somecompany.com</host>
          <port>80</port>
          <username>user</username>
         <password>pass</password>
    </proxy>
 </proxies>
</settings>

Then you can change the protocol to http. Im using maven 2.2.1.

ahvargas
+1  A: 

It will really come down to what your company has done to setup their firewall. If the firewall requires NTLMv2 authentication then Maven won't do that alone (it's supposed to work soon, but I tried on the v3 alpha without any luck).

While it may not be the ideal solution you are looking for, I found that the best case for this kind of thing is to install CNTLM and a local repository proxy within the firewall (such as Sonatype Nexus, Jfrog's Artifactory, or Apache Archiva.

CNTLM just plain works (TM). It took about 15 minutes to install and play around with and I haven't had to think about it since.

I've used Artifactory and Nexus and they are both pretty comparable. I've read that Artifactory comes preloaded with most of the popular Maven sites so you may not have to fiddle with it as much. (I definitely had to add several third party repos to Nexus). You can get a good comparison of them here.

An added benefit of this solution is that your builds should be significantly faster (and your team will thank you).

jeckhart
@jeckhart - We do have an internal repository but I don't have administration rights. It took them 5 days to add JBoss for me! So I need the solution for the next time I hit this barrier. The NTLM issue sounds like its my problem. I will investigate that further.
bmatthews68
A: 

If NTLM is the problem and If you are using Eclipse for your project, then you can try starting Eclipse with the following parameters. I had tried this once when i had issues accessing eclipse update sites due to our proxy.

-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient  
-Dhttp.proxyPort=8080  
-Dhttp.proxyHost=<Proxy Host Name>  
-Dhttp.proxyUser=<>  
-Dhttp.proxyPassword=<>  
-Dhttp.nonProxyHosts=localhost  

Source : http://wiki.eclipse.org/ECF_Filetransfer_Support_for_NTLMv2_Proxies

Manoj