aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven setup is not working in Eclipse or Netbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven setup is not working in Eclipse or Netbeans" Watch "Maven setup is not working in Eclipse or Netbeans" New topic
Author

Maven setup is not working in Eclipse or Netbeans

pratap tamatam
Greenhorn

Joined: Oct 21, 2008
Posts: 3
Hi-

When I am trying to setup Maven, got below error. I am not working under firewalls.

Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Jun 04, 2013 3:07:48 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Permission denied: connect
Jun 04, 2013 3:07:48 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: Retrying connect
Jun 04, 2013 3:07:48 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Permission denied: connect
Jun 04, 2013 3:07:48 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: Retrying connect
Jun 04, 2013 3:07:48 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Permission denied: connect
Jun 04, 2013 3:07:48 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect

INFO: Retrying connect

Can some body help me.

----------Pratap
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

If you enter the URL from the error message in your browser, what happens?

You mentioned NetBeans and Eclipse. Is this output generated from inside one of them? If so, which one? Also, could you try running mvn from the command prompt and see if that does something different.

You you have a proxy server in your browser configuration? (Which OS and browser are you using, we can provide more specific debugging guidance if we know)


JBoss In Action
pratap tamatam
Greenhorn

Joined: Oct 21, 2008
Posts: 3
Hi Peter-

I am able to access "http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom" from browser.Below error message is generated from Netbeans.

Command prompt:-
C:\Users\pc>mvn -version
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:28+0530)
Maven home: D:\apache-maven-3.0.5\bin\..
Java version: 1.7.0_11, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.7.0_11\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
C:\Users\pc>

Command prompt eror-

C:\Users\pc>mvn archetype:generate
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Jun 05, 2013 7:57:06 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Permission denied: connect
Jun 05, 2013 7:57:06 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: Retrying connect
Jun 05, 2013 7:57:06 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Permission denied: connect
Jun 05, 2013 7:57:06 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: Retrying connect


I am using Win7 OS. I do not have proxy. I have added ' _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true'as Env variable and disabled IPv6.

Thank you.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

First thing I would do is upgrade to the latest JDK 7 - 7u11 is really old. Also, I don't have java.net.preferIPv4Stack set, try unsetting it. Finally, try running from the command line and not NetBeans.
alan freeman
Greenhorn

Joined: Nov 25, 2014
Posts: 1
I encountered pratap's problem (Permiission denied: connect) with a new laptop so was able to study it under more controlled conditions.
I think it is a firewall problem. I tried various other fixes that are recommended such as adding -Djava.net.preferIP4Stack=true to the command line, but these did not work.
I don't think the JDK was a cause, because I installed the latest JRE (8) and JDK (1.8)
The puzzle was also that my setup was working perfectly on an identical laptop (Yoga Pro running Windows 8.1) - I happened to have two for a brief while because the manufacturers had send me the wrong model. Only difference was memory size.
Also for this reason, a clean Windows 8.1 Install on both machines

The only differences between the setups that I could detect were
(1) the new machine (call it Yoga 2) was running ZoneAlarrm instead of McAfee
(2) the new machine could have downloaded some more recent Windows 8.1 upgrades. I don't know

To ensure a controlled environment I ran Maven from within Netbeans and set up a Maven Web Application project. The problem reproduces whether Maven is run from the command line or within NetBeans, but Netbeans gives more human-readable information (IMO as a relative Maven newbie)

What seemed to fix the problem was turning Windows Firewall off. I notice that Pratap says "I don't use Firewall" but I think it is the Windows default - at least for Windows 8 it is. So you have to consciously turn it off.

Here are the steps I took and what happened:

Uninstall Netbeans, Tomcat and Glassfish
Delete Netbeans directory in Documents
Delete .nb1 directory
Delete .m2 directory
Delete all Netbeans settings in Program Files
Delete all Netbeans settings in Appdata

JRE8 and JDK 1.8 not deleted

Download and re-install Netbeans "all" 8.0.1 with Glassfish and Tomcat enabled

Create a new Maven project (File->New->Maven->Web application
No change to Maven settings

Results

Project created and runs
Programme spends long time (>30 minuts) Importing the index
When it is finished, you can see .m2 has been populated
But the ''Services>Maven Repositories>Central Repository shows flickering 'looking for index' message

Now, the project will not build. Instead it reports that it cannot access the remote repository, with the error 'connect'

Next steps:

Disabled ZoneAlarm
Switched off Windows Firewall

Results:

Now it builds, also carries out a clean and build
Also after some downloading (<5 minutes) it displays the Central Repository
However, all this still succeeds after firewall is switched on - I suspect because it has downloaded all the dependencies that it needs.

I don't yet understand which selective Firewall Settings I should use to ensure that the Maven repository can be accessed but this should be clear from the error message ie repo1.maven.org or whatever repository the projects and plugins are trying to access.

I hope this helps somebody because the problem intrigued me but also held me up. I am sure many newbies encounter problems like this, for which there is a fix but it takes a while to find, and generally it is much harder at the early stage when you are still learning a new technology, because you can't even get to the point where the technology works, in order to study it. In this case I was lucky that it worked the first time, but not the second.

Cheers
Alan

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven setup is not working in Eclipse or Netbeans