Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set NetBeans 7 internet connection?

Tags:

java

netbeans

I am using NetBeans 7. Tried to create a Maven Java project, failed.

In NetBeans

mvn.bat -DarchetypeVersion=1.1 -Darchetype.interactive=false -DgroupId=com.mycompany -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeRepository=http://repo1.maven.org/maven2/ -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.maven.archetypes -Dbasedir=F:\\NetBeansProjects -Dpackage=com.mycompany.mavenproject1 -DartifactId=mavenproject1 "-Dmaven.repo.local=C:\\Documents and Settings\\xxx\\.m2" --batch-mode archetype:generate

It failed, because

Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: connect

Then copy that command into DOS, it works.

Looks like NetBeans can't connect to internet. Eclipse on the same machine can connect to remote internet.

like image 640
user534009 Avatar asked May 24 '11 16:05

user534009


2 Answers

The issue is that NetBeans 7 comes bundled with an embedded version of Maven. This means that any proxy settings you may have configured under your downloaded Maven distribution are not used by NetBeans.

You have two options:

  • Tools > Options > Miscellaneous > Maven > Maven Home -- point NetBeans to your existing Maven download; that is, where you have configrued settings.xml with your proxy settings;

  • Edit path/to/nb7/java/maven/conf/settings.xml with your proxy settings.

like image 142
wulfgarpro Avatar answered Oct 01 '22 21:10

wulfgarpro


Well it is not necessarily internet issue

  • If you are behind proxies you need to tell maven in settings.xml about proxy
  • If that lib ins't available on the maven repos download it from official sitre and install it manually
like image 30
jmj Avatar answered Oct 01 '22 20:10

jmj